|
Message-ID: <20170610143225.GI30784@example.net> Date: Sat, 10 Jun 2017 16:32:25 +0200 From: u-uy74@...ey.se To: musl@...ts.openwall.com Subject: Re: a possible need for MAP_FIXED in ldso/dynlink.c ? On Sat, Jun 10, 2017 at 08:26:10AM -0400, Rich Felker wrote: > On Sat, Jun 10, 2017 at 12:51:51PM +0200, u-uy74@...ey.se wrote: > > Adding the MAP_FIXED flag, both conditionally or not, seems to work > > around the particular problem but I am unsure about all its implications > > and consequences, among others under the current Linux implementation > > of the Lunux ABI. > Use of MAP_FIXED with a memory range you don't already own is an > invalid and unsafe operation. You may end up mapping over top of > yourself, even. But the latter should be possible to avoid as long as we know where ourself is located (?) Or do we? > Implementations should honor the requested address > passed to mmap and only fail to provide it if it's already in use. I did not see this statement anywhere in the mmap() documentation (and even if I am misinformed, you say "should" not "must"). E.g. http://pubs.opengroup.org/onlinepubs/9699919799/functions/mmap.html says "When MAP_FIXED is not set, the implementation uses addr in an implementation-defined manner to arrive at pa." > applications that don't have a reason for requesting a > particular address should, and do, pass 0 as the request. Notwithstanding this, I find the API very unclear about how to safely check whether the use of a certain address range is impossible or just differs from the particular "implementation-defined manner" to derive the returned value. Does this mean that musl can not implement the explicit dynamic loader with mere Posix mmap(), only with the "more tightly specified Linux mmap()"? Regards, Rune
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.