This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]
- From: Stefan Liebler <stli at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org
- Cc: Florian Weimer <fweimer at redhat dot com>
- Date: Thu, 1 Dec 2016 17:25:19 +0100
- Subject: Re: [PATCH] Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]
- Authentication-results: sourceware.org; auth=none
- References: <7650651f-f268-6405-c04c-61aa18d166f9@redhat.com> <78fc80c3-d047-2b41-b600-8003f5937ac3@redhat.com>
On 11/29/2016 06:31 PM, Florian Weimer wrote:
On 11/14/2016 04:07 PM, Florian Weimer wrote:
The attached patch depends on the elf/dl-load.c clean I posted today,
and the addition of the __sigsetjmp hidden definitions on architectures
which lack them.
The removal of the two function pointers from libc.so (the one in
rtld_global, and the receiver pointer internal to elf/dl-error.c) is
desirable from a security perspective, too.
I added a test. This is what I want to commit soon unless some objects.
Thanks,
Florian
Hi Florian,
The first dlopen ("tst-latepthreadmod.so", RTLD_LOCAL | RTLD_LAZY) call
in elf/tst-latepthread.c fails on s390x with "error: dlopen failed:
.../build-s390x/elf/tst-latepthreadmod.so: undefined symbol:
this_function_is_not_defined".
In elf/tst-latepthreadmod.c, this_function_is_not_defined is a sibling
call which leads to a R_390_GLOB_DAT relocation in .rela.dyn instead of
a R_390_JMP_SLOT in .rela.plt.
As RTLD_LAZY skips the JMP_SLOT relocations, but not GLOB_DAT ones, the
dlopen call fails.
If elf/tst-latepthreadmod.c is build with -fno-optimize-sibling-calls, a
JMP_SLOT relocation is generated for this_function_is_not_defined and
the test passes.
Okay to commit?
Bye.
Stefan
---
ChangeLog:
* elf/Makefile (CFLAGS-tst-latepthreadmod.c): Add
-fno-optimize-sibling-calls.
diff --git a/elf/Makefile b/elf/Makefile
index 33b003b..18b3e2a 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -1271,6 +1271,9 @@ LDFLAGS-tst-audit12mod2.so = -Wl,--version-script=tst-audit12mod2.map
# Force lazy binding for the same reason.
LDFLAGS-tst-latepthreadmod.so = \
-Wl,-z,lazy -Wl,--unresolved-symbols=ignore-all
+# Do not optimize sibling calls as the test relies on a JMP_SLOT relocation for
+# function this_function_is_not_defined.
+CFLAGS-tst-latepthreadmod.c = -fno-optimize-sibling-calls
$(objpfx)tst-latepthreadmod.so: $(shared-thread-library)
$(objpfx)tst-latepthread: $(libdl)
$(objpfx)tst-latepthread.out: $(objpfx)tst-latepthreadmod.so