diff options
author | Hector Martin <marcan@marcan.st> | 2023-11-28 15:23:07 +0900 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2023-11-28 17:28:02 +0000 |
commit | 3921c5b40f293c57cb326f58713c924b0662ef59 (patch) | |
tree | dc7f5695df724748db10ea6d6e1d8887439caba2 /sysdeps/x86_64/multiarch/wcsrchr-evex512.S | |
parent | 06bbe63e367abd5f7b225cbae30d1e487f237c85 (diff) | |
download | glibc-3921c5b40f293c57cb326f58713c924b0662ef59.tar.gz glibc-3921c5b40f293c57cb326f58713c924b0662ef59.tar.xz glibc-3921c5b40f293c57cb326f58713c924b0662ef59.zip |
elf: Fix TLS modid reuse generation assignment (BZ 29039)
_dl_assign_tls_modid() assigns a slotinfo entry for a new module, but does *not* do anything to the generation counter. The first time this happens, the generation is zero and map_generation() returns the current generation to be used during relocation processing. However, if a slotinfo entry is later reused, it will already have a generation assigned. If this generation has fallen behind the current global max generation, then this causes an obsolete generation to be assigned during relocation processing, as map_generation() returns this generation if nonzero. _dl_add_to_slotinfo() eventually resets the generation, but by then it is too late. This causes DTV updates to be skipped, leading to NULL or broken TLS slot pointers and segfaults. Fix this by resetting the generation to zero in _dl_assign_tls_modid(), so it behaves the same as the first time a slot is assigned. _dl_add_to_slotinfo() will still assign the correct static generation later during module load, but relocation processing will no longer use an obsolete generation. Note that slotinfo entry (aka modid) reuse typically happens after a dlclose and only TLS access via dynamic tlsdesc is affected. Because tlsdesc is optimized to use the optional part of static TLS, dynamic tlsdesc can be avoided by increasing the glibc.rtld.optional_static_tls tunable to a large enough value, or by LD_PRELOAD-ing the affected modules. Fixes bug 29039. Reviewed-by: Szabolcs Nagy <szabolcs.nagy@arm.com>
Diffstat (limited to 'sysdeps/x86_64/multiarch/wcsrchr-evex512.S')
0 files changed, 0 insertions, 0 deletions