]> sourceware.org Git - glibc.git/commit
elf: Switch to main malloc after final ld.so self-relocation master
authorFlorian Weimer <fweimer@redhat.com>
Wed, 6 Nov 2024 09:33:44 +0000 (10:33 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Wed, 6 Nov 2024 09:33:44 +0000 (10:33 +0100)
commitc1560f3f75c0e892b5522c16f91b4e303f677094
tree2bc23ca5a02629376cd1edbdefb736ea62782de4
parentf2326c2ec0a0a8db7bc7f4db8cce3002768fc3b6
elf: Switch to main malloc after final ld.so self-relocation

Before commit ee1ada1bdb8074de6e1bdc956ab19aef7b6a7872
("elf: Rework exception handling in the dynamic loader
[BZ #25486]"), the previous order called the main calloc
to allocate a shadow GOT/PLT array for auditing support.
This happened before libc.so.6 ELF constructors were run, so
a user malloc could run without libc.so.6 having been
initialized fully.  One observable effect was that
environ was NULL at this point.

It does not seem to be possible at present to trigger such
an allocation, but it seems more robust to delay switching
to main malloc after ld.so self-relocation is complete.
The elf/tst-rtld-no-malloc-audit test case fails with a
2.34-era glibc that does not have this fix.

Reviewed-by: DJ Delorie <dj@redhat.com>
elf/Makefile
elf/dl-support.c
elf/rtld.c
elf/tst-rtld-no-malloc-audit.c [new file with mode: 0644]
elf/tst-rtld-no-malloc-preload.c [new file with mode: 0644]
elf/tst-rtld-no-malloc.c [new file with mode: 0644]
This page took 0.044764 seconds and 5 git commands to generate.