mailing list of musl libc
 help / color / mirror / code / Atom feed
* pthread_getattr_np() vs explicit runtime loader
@ 2015-09-20  6:39 u-wsnj
  2015-09-20 16:34 ` Rich Felker
  0 siblings, 1 reply; 18+ messages in thread
From: u-wsnj @ 2015-09-20  6:39 UTC (permalink / raw)
  To: musl

Hello,

musl 1.1.8 on ia32 Linux, building gcc 5.2.0 succeeds.

Nevertheless a subset of the resulting executables segfault when run by
an explicit loader (which is the vital mode of operation in our setups).

They do not seem to segfault when using the implicit loader
which suggests the result depends on the memory mapping layout.

Moreover, the last syscalls seen before the crash are mremap(),
presumably reflecting that pthread_getattr_np() is involved.

It looks like (according to a discussion in mail archives) the logic
in this function makes assumptions which not necessarily are true while
using an explicit runtime loader.

Would you comment on whether this guess is correct and hopefully make
pthread_getattr_np() work even with the explicit loader?

The strace examples limited to mremap() follow.
The same files and libraries are being used, also the same loader
path is used explicitly as embedded in the executable.

-----------------------------------------------------------------
$ strace -e mremap \
  /..../<loader> --library-path ...<libs> /..../jv-convert --help
mremap(0xffffc000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffffb000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffffa000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff9000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff8000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff7000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff6000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff5000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff4000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff3000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff2000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff1000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff0000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffef000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffee000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffed000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffec000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffeb000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffea000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe9000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe8000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe7000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe6000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe5000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe4000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe3000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe2000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe1000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe0000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdf000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffde000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdd000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdc000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdb000, 4096, 8192, 0)       = -1 EFAULT (Bad address)
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 30289 detached
-----------------------------------------------------------------
$ LD_LIBRARY_PATH=...<libs> strace -e mremap /..../jv-convert --help
mremap(0xffffc000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffffb000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffffa000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff9000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff8000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff7000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff6000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff5000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff4000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff3000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff2000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff1000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xffff0000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffef000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffee000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffed000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffec000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffeb000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffea000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe9000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe8000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe7000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe6000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe5000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe4000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe3000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe2000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe1000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffe0000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdf000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffde000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdd000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdc000, 4096, 8192, 0)       = -1 ENOMEM (Cannot allocate memory)
mremap(0xfffdb000, 4096, 8192, 0)       = -1 EFAULT (Bad address)
Usage: jv-convert [OPTIONS] [INPUTFILE [OUTPUTFILE]]

Convert from one encoding to another.

   --encoding FROM
   --from FROM        use FROM as source encoding name
   --to TO            use TO as target encoding name
   -i FILE            read from FILE
   -o FILE            print output to FILE
   --reverse          swap FROM and TO encodings
   --help             print this help, then exit
   --version          print version number, then exit

`-' as a file name argument can be used to refer to stdin or stdout.
Process 30291 detached
-----------------------------------------------------------------

Regards,
Rune



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

end of thread, other threads:[~2015-10-09  5:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-20  6:39 pthread_getattr_np() vs explicit runtime loader u-wsnj
2015-09-20 16:34 ` Rich Felker
2015-09-20 17:22   ` u-wsnj
2015-09-20 18:27     ` Rich Felker
2015-09-20 19:30       ` u-wsnj
2015-09-20 19:41         ` Rich Felker
2015-09-21  7:57           ` u-wsnj
2015-09-30 15:43           ` u-uy74
2015-09-30 20:35             ` Update: [musl] " u-uy74
2015-10-06 11:34               ` musl bug or not, real or not? (Was: [musl] Update: [musl] pthread_getattr_np() vs explicit runtime) loader u-uy74
2015-10-06 14:36                 ` Isaac Dunham
2015-10-07  6:48                   ` u-uy74
2015-10-06 17:07                 ` Rich Felker
2015-10-07  7:27                   ` u-uy74
2015-10-07  7:43                     ` Timo Teras
2015-10-07 10:59                       ` u-uy74
2015-10-08 16:48                       ` Rich Felker
2015-10-09  5:39                         ` Timo Teras

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).