|
|
Message-ID: <20170610105151.GG30784@example.net>
Date: Sat, 10 Jun 2017 12:51:51 +0200
From: u-uy74@...ey.se
To: musl@...ts.openwall.com
Subject: a possible need for MAP_FIXED in ldso/dynlink.c ?
Hello,
Running musl-based (1.1.16) Linux binaries (i386) under Linux ABI
on FreeBSD (11.0-RELEASE amd64), with explicit use of the loader like
/..../libc.so --library-path <something> <prog> <args>
fails when mmap() returns a different address than requested
which is rejected by the musl loader when mapping the executable:
"Not a valid dynamic program",
due to:
map = ....
: mmap((void *)addr_min, map_len, prot,
MAP_PRIVATE, fd, off_start);
...
/* If the loaded file is not relocatable and the requested address is
* not available, then the load operation must fail. */
if (eh->e_type != ET_DYN && addr_min && map!=(void *)addr_min) {
errno = EBUSY;
goto error;
...
mmap() returning a different address does not necessarily mean that
the requested one is not available.
I wonder whether adding MAP_FIXED to MAP_PRIVATE above would be a
useful approach (conditionally on eh->e_type==ET_EXEC ?).
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.
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.