From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 20 15:49:08 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 740E2B7; Wed, 20 Feb 2013 15:49:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 17050D75; Wed, 20 Feb 2013 15:49:07 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.6/8.14.6) with ESMTP id r1KFmui7070158; Wed, 20 Feb 2013 17:48:56 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.7.4 kib.kiev.ua r1KFmui7070158 Received: (from kostik@localhost) by tom.home (8.14.6/8.14.6/Submit) id r1KFmtgP070157; Wed, 20 Feb 2013 17:48:55 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 20 Feb 2013 17:48:55 +0200 From: Konstantin Belousov To: Damjan Jovanovic Subject: Re: [patch] Wine DLL base address patches Message-ID: <20130220154855.GF2598@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="L2zmpNdaDxUzilj2" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org, tijl@coosemans.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Feb 2013 15:49:08 -0000 --L2zmpNdaDxUzilj2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Feb 20, 2013 at 05:29:01PM +0200, Damjan Jovanovic wrote: > Hi >=20 > Wine needs some of its libraries to be loaded at specific base > addresses (https://wiki.freebsd.org/Wine), something FreeBSD currently > lacks. >=20 > I've written a patch to the dynamic loader (/libexec/ld-elf.so.1) that > loads libraries at their preferred base addresses > (http://www.freebsd.org/cgi/query-pr.cgi?pr=3D176216), as well as a port > of Prelink to FreeBSD which Wine uses to set base addresses > (http://www.freebsd.org/cgi/query-pr.cgi?pr=3D176283). Both work :-), > the changed dynamic loader doesn't show any problems in a few days of > testing, and prelink works with the --reloc-only option as used by > Wine. >=20 > Please review/test/comment/commit. Unfortunately, it is not safe. MAP_FIXED overrides any previous mappings which could exist at the specified address. What you could do, is - either specify the desired base without MAP_FIXED. Kernel takes the base as the hint, but only uses it if the request completely fits into the hinted area without overriding any existing mapping. Also, the heap is explicitely avoided. The code would need to check if kernel honored hint by comparing the actual map address with the desired address, and act accordingly. - or add a new mmap(2) flag, which would specify that mapping should be done at that address, if possible to not overlap with existing mapping, otherwise the mapping should fail. --L2zmpNdaDxUzilj2 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) iQIcBAEBAgAGBQJRJPBnAAoJEJDCuSvBvK1B6RgP/14vXBpPuyAVre0mJ3Dh3TMl zYVmheN9j5Un2a0LTq1U9UcD6FADWwY0G+0J2eSZHVSFOXA3YFxHq73+H9XNawOF U+AHH0+4qQ/27jTJjr4vThjfiFuvN0ArkUrj+haAPMZlhQdr0y1FZl7stuyLo+gb YYkYnZOu/tqvvT5MHVPNjgl9vWMANGcm41BzrGRK40NZ24kOhXwr5I1h5uCGFR7/ gxD5SUtKHVhT1ZF5pMVvObOcTAQrz/nlb6gI2sxhpdU7AnOLpCCGm0+ThNI3tmA8 fmqGze92fU0TFdAWMootevLVuOwgfZwlyUno++RG56zdtFJHBsHCCqvMlsywcRHD 4U15XSmFFDU5+WA4xjbPou/JVOQBUnyRQ6oYYQR8sdt7/tF77pYSvVcR9/V+eujU cI/Zma512iwIW6uwHh9bI1dC1Os3Zqi+OBMelXFdF6zLqZfaMVtygS+E6comvj6j 7EvkzhGNJbByD8+3BD1huHPC7dP0E7f7sYIFLK72WQNLGm68RNl55IjB5EuhcBXP nzgyMyCKCr8XhtB5Kzzwjs9rAVS14WljX00+WJUH4JhF24ddPs/huLDzM9wAb554 zDMTvicHFZSjG+uX7F9/3cgzm6X6Wbw1f5Tnip46FVkUyMfWs+7lq6uUn18oaR3w GHjLcqV1zuKbcFyUUvuY =j2JC -----END PGP SIGNATURE----- --L2zmpNdaDxUzilj2--