mailing list of musl libc
 help / color / mirror / code / Atom feed
* a possible need for MAP_FIXED in ldso/dynlink.c ?
@ 2017-06-10 10:51 u-uy74
  2017-06-10 12:26 ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: u-uy74 @ 2017-06-10 10:51 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-10 17:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-10 10:51 a possible need for MAP_FIXED in ldso/dynlink.c ? u-uy74
2017-06-10 12:26 ` Rich Felker
2017-06-10 14:32   ` u-uy74
2017-06-10 15:01     ` Rich Felker
2017-06-10 17:00       ` u-uy74

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).