diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2023-11-29 11:31:37 +0000 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2023-12-22 14:29:47 +0000 |
commit | 0de9082ed8d8f149ca87d569a73692046e236c18 (patch) | |
tree | a6f4fa565cfdad20b5af644a822df42f2ff348b7 /abi-tags | |
parent | ccdc4cba07684fe1397e1f5f134a0a827af98c04 (diff) | |
download | glibc-0de9082ed8d8f149ca87d569a73692046e236c18.zip glibc-0de9082ed8d8f149ca87d569a73692046e236c18.tar.gz glibc-0de9082ed8d8f149ca87d569a73692046e236c18.tar.bz2 |
elf: Add TLS modid reuse test for bug 29039
This is a minimal regression test for bug 29039 which only affects
targets with TLSDESC and a reproducer requires that
1) Have modid gaps (closed modules) with old generation.
2) Update a DTV to a newer generation (needs a newer dlopen).
3) But do not update the closed gap entry in that DTV.
4) Reuse the modid gap for a new module (another dlopen).
5) Use dynamic TLSDESC in that new module with old generation (bug).
6) Access TLS via this TLSDESC and the now outdated DTV.
However step (3) in practice rarely happens: during DTV update the
entries for closed modids are initialized to "unallocated" and then
dynamic TLSDESC calls __tls_get_addr independently of its generation.
The only exception to this is DTV setup at thread creation (gaps are
initialized to NULL instead of unallocated) or DTV resize where the
gap entries are outside the previous DTV array (again NULL instead
of unallocated, and this requires loading > DTV_SURPLUS modules).
So the bug can only cause NULL (+ offset) dereference, not use after
free. And the easiest way to get (3) is via thread creation.
Note that step (5) requires that the newly loaded module has larger
TLS than the remaining optional static TLS. And for (6) there cannot
be other TLS access or dlopen in the thread that updates the DTV.
Tested on aarch64-linux-gnu.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
(cherry picked from commit 980450f12685326729d63ff72e93a996113bf073)
Diffstat (limited to 'abi-tags')
0 files changed, 0 insertions, 0 deletions