[PATCH 3/3] elf: Relocate libc.so early during startup and dlmopen (bug 31083)

Florian Weimer fweimer@redhat.com
Wed Dec 13 12:18:36 GMT 2023


* Stefan Liebler:

> Hi Florian,
>
> can you please have a look at elf/tst-nodeps2. Does it also fail on your
> side?
>
> If I configure with --enable-hardcoded-path-in-tests,
> it fails:
> - on x86_64: Didn't expect signal from child: got `Aborted'
> - on s390x: Didn't expect signal from child: got `Floating point exception'

Well, that's pretty worrisome, but it turns out to be a test issue.  I
think the reason for the crash is that the test escapes the test
environment during dlmopen:

     62632:     relocation processing: /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps2-mod.so
     62632:     object=/home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps2-mod.so [1]
     62632:      scope 0: /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps2-mod.so /lib64/libc.so.6 /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps1-mod.so /lib64/ld-linux-x86-64.so.2
     62632:     
     62632:     object=/lib64/libc.so.6 [1]
     62632:      scope 0: /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps2-mod.so /lib64/libc.so.6 /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps1-mod.so /lib64/ld-linux-x86-64.so.2
     62632:     
     62632:     object=/home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps1-mod.so [1]
     62632:      scope 0: /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps2-mod.so /lib64/libc.so.6 /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps1-mod.so /lib64/ld-linux-x86-64.so.2
     62632:     
     62632:     object=/lib64/ld-linux-x86-64.so.2 [1]
     62632:      scope 0: /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps2-mod.so /lib64/libc.so.6 /home/fweimer/src/gnu/glibc/build-master/elf/tst-nodeps1-mod.so /lib64/ld-linux-x86-64.so.2
     62632:     

That happens because the relevant objects are not linked with -rpath
(they are intentionally minimal).

I don't know what the best way to fix this.  Is there a makefile
variable to get the required -rpath arguments for
--enable-hardcoded-path-in-tests builds?  Or we could set
LD_LIBRARY_PATH:

tst-nodeps2-ENV = LD_LIBRARY_PATH=$(objpfx):$(common-objpfx)

Thanks,
Florian



More information about the Libc-alpha mailing list