Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp638849pxb; Thu, 19 Nov 2020 09:58:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0oALy5MOzVjOY5g0D0wJr3KIDYBsPrbM9z6iKyR1pOrfNj4TJX96POLRi8hFZqkAwUgz3 X-Received: by 2002:a05:6402:1a2b:: with SMTP id be11mr2796073edb.353.1605808737614; Thu, 19 Nov 2020 09:58:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605808737; cv=none; d=google.com; s=arc-20160816; b=XrbC0WC2Nywfk2r2v/BKRTOSjK5DrfTq3DatuCC9SA2VWiuQV/0CUl6mD6jdvkdoFT 0k66KvgZIJZMthqTrU3jn01JrX20qQIT4Zm4sV6dBi1E0PK8LqZXoQRneYzZwPqRqEUA ioVghYkTRP0Q9mCuhAVZIQHstX/UrZUqHLdQ3EwPEtdH4SDZTIu7UaT5HePc8lODc6TW yT3QGHu00Bg2zaJgJkm8ehqfXIZneF2jaqtiZqvpGp3ApRjLwFhRTAQF8ikHZW7VNr8D zaSiib8qLKV9BQ8zsH+8287i73OlZ6xhlGfEAx+lnj97ss/uSPW5fUPgX/NY2h32CSqP 6lUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=rSRYU7xLV62aX7lgZss7QSTCmwxqMSMS6lXe30lu2/k=; b=x137QIo36XGdIYRMbAh1FnUr4atUmY59eMA9BFMOQR1RUJU1NSFnQ4US9e0KDkqmo3 A8zI3xh0lYbqnCUcuIhw7Q0H0Lu1ck7v1s46hPeEQ3QNB4CK6E3aHGS/tqJNAbMrsAnj 1BcRWG3+RhCom0GC/j7hfugnK/NoTcapjFxztG2XIFJhlwRqGcLsj0MGrhCW4DfaUWQO 0GZUaodlJHszO33PSQR+YG42dbmdnIbb9G7uJS05XcntZ74kzh+YQAtX51SGDExXa6x1 onA8AAS2JV69u/u2waRuET6QX/6GLOTKYvdQzqHMzfH6ozgt4z/KxjrYhD/HZ+F0nKeU Sw+g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w19si253694edi.177.2020.11.19.09.58.34; Thu, 19 Nov 2020 09:58:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729335AbgKSR5L convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Nov 2020 12:57:11 -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)