[PATCH 1/8] elf: Propagate the pointer guard to ld.so loaded via static dlopen (BZ 34196)

Sachin Monga smonga@linux.ibm.com
Tue Jun 30 18:15:15 GMT 2026


On 03/06/26 5:34 am, Adhemerval Zanella wrote:
> The static-dlopen does not initialize the pointer guard for ABIs that
> define THREAD_SET_POINTER_GUARD.  Besides not properly guard the
> pointer if a libc.so symbol is called, this can leads to setjmp
> failures (a jmp_buf set up by the loaded ibc.so.6 cannot be restored
> by the static program's __longjmp, and vice versa).
>
> Seed the just-mapped loader's __pointer_chk_guard from the program's
> __pointer_chk_guard_local in __rtld_static_init, next to the other
> runtime values copied there.
>
> Checked on aarch64-linux-gnu, x86_64-linux-gnu, and i686-linux-gnu.
> ---
>   elf/Makefile                                  |  6 +++
>   elf/rtld_static_init.c                        | 12 +++++
>   elf/tst-ptrguard-static-dlopen-mod.c          | 29 +++++++++++
>   elf/tst-ptrguard-static-dlopen.c              | 51 +++++++++++++++++++
>   .../tst-ptrguard-static-dlopen.script         |  1 +
>   5 files changed, 99 insertions(+)
>   create mode 100644 elf/tst-ptrguard-static-dlopen-mod.c
>   create mode 100644 elf/tst-ptrguard-static-dlopen.c
>   create mode 100644 elf/tst-ptrguard-static-dlopen.root/tst-ptrguard-static-dlopen.script
>
Hi Adhemerval

/tst-ptrguard-static-dlopen/ FAILs on powerpc64le.  It is the first test 
in both tests-static and tests-container, and the tests-container rule 
runs the (dynamically linked) support/test-container through
$(test-via-rtld-prefix), which is empty for tests-static.  The helper is 
thus bound to the system loader/libc instead of the build tree, and 
fails wherever the system glibc predates the build tree. On the system I 
was performing my execution, system installed glibc was 2.34 and hence I 
encountered this failure. :

   support/test-container: libc.so.6: version `GLIBC_2.38' not found 
before the test itself runs. Recent system glibc masks it, which is why 
it might have passed on other archs.

Do you think this assessment is correct or I am missing something here ?

Proposed Fix: add $(test-container-via-rtld-prefix) (= $(rtld-prefix), 
empty under build-hardcoded-path-in-tests) and use it in the 
tests-container rule.
Identical to $(test-via-rtld-prefix) for existing dynamic container 
tests; only static ones change.  I checked it on powerpc64le and x86_64.

Given the freeze on the 4th, OK to post this for the release?

Regards,
Sachin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20260630/d9e8d896/attachment.htm>


More information about the Libc-alpha mailing list