From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E086C63697 for ; Thu, 19 Nov 2020 17:57:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C512E246D1 for ; Thu, 19 Nov 2020 17:57:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729790AbgKSR5M convert rfc822-to-8bit (ORCPT ); Thu, 19 Nov 2020 12:57:12 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:29926 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728451AbgKSR5L (ORCPT ); Thu, 19 Nov 2020 12:57:11 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-194-1fE0Cy52OzOiF703RXrXFQ-1; Thu, 19 Nov 2020 17:57:07 +0000 X-MC-Unique: 1fE0Cy52OzOiF703RXrXFQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Thu, 19 Nov 2020 17:57:06 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Thu, 19 Nov 2020 17:57:06 +0000 From: David Laight To: 'Rich Felker' , Gabriel Krisman Bertazi CC: "libc-alpha@sourceware.org" , Florian Weimer , "linux-kernel@vger.kernel.org" , Paul Gofman Subject: RE: Kernel prctl feature for syscall interception and emulation Thread-Topic: Kernel prctl feature for syscall interception and emulation Thread-Index: AQHWvps8vCklDp4dlUSnkfZ/iVi4VanPuwKQ Date: Thu, 19 Nov 2020 17:57:06 +0000 Message-ID: References: <873616v6g9.fsf@collabora.com> <20201119151317.GF534@brightrain.aerifal.cx> <87h7pltj9p.fsf@collabora.com> <20201119162801.GH534@brightrain.aerifal.cx> <87eekpmeux.fsf@collabora.com> <20201119173938.GJ534@brightrain.aerifal.cx> In-Reply-To: <20201119173938.GJ534@brightrain.aerifal.cx> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > The Windows code is not completely loaded at initialization time. It > > also has dynamic libraries loaded later. yes, wine knows the memory > > regions, but there is no guarantee there is a small number of segments > > or that the full picture is known at any given moment. > > Yes, I didn't mean it was known statically at init time (although > maybe it can be; see below) just that all the code doing the loading > is under Wine's control (vs having system dynamic linker doing stuff > it can't reliably see, which is the case with host libraries). Since wine must itself make the mmap() system calls that make memory executable can't it arrange for windows code and linux code to be above/below some critical address? IIRC 32bit windows has the user/kernel split at 2G, so all the linux code could be shoe-horned into the top 1GB. A similar boundary could be picked for 64bit code. This would probably require flags to mmap() to map above/below the specified address (is there a flag for the 2G boundary these days - wine used to do very horrid things). It might also need a special elf interpreter to load the wine code itself high. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)