[PATCH] Implement _dl_catch_error, _dl_signal_error in libc.so [BZ #16628]

Stefan Liebler stli@linux.vnet.ibm.com
Thu Dec 1 16:25:00 GMT 2016


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 20161201_elf_tst-latepthread.patch
Type: text/x-patch
Size: 668 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20161201/63879dec/attachment.bin>


More information about the Libc-alpha mailing list