1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:28:11 +00:00
serenity/Userland/Libraries/LibELF
Gunnar Beutner c32b58873a LibELF: Fix calculation for TLS relocations
The calculation for TLS relocations was incorrect which would
result in overlapping TLS variables when more than one shared
object used TLS variables.

This bug can be reproduced with a shared library and a program
like this:

    $ cat tlstest.c
    #include <string.h>
    __thread char tls_val[1024];
    void set_val() { memset(tls_val, 0, sizeof(tls_val)); }

    $ gcc -g -shared -o usr/lib/libtlstest.so tlstest.c

    $ cat test.c
    void set_val();
    int main() { set_val(); }
    $ gcc -g -o tls test.c -ltlstest

Due to the way the TLS relocations are done this program would
clobber libc's TLS variables (e.g. errno).
2021-04-19 12:14:43 +02:00
..
Arch/i386 LibC: Remove text relocation 2021-02-19 09:04:05 +01:00
AuxiliaryVector.h Everywhere: Remove unnecessary clang-format offs 2021-03-04 11:01:48 +01:00
CMakeLists.txt LibELF+LibTest: Fix serenity_install_sources() paths 2021-03-15 09:06:10 +01:00
CoreDump.h Kernel: Set "pledge_violation" coredump metadata in REQUIRE_PROMISE() 2021-01-20 21:01:15 +01:00
DynamicLinker.cpp LibC+LibELF: Implement support for the dl_iterate_phdr helper 2021-04-18 10:55:25 +02:00
DynamicLinker.h Ports: Update the gcc port with the patches from the toolchain 2021-04-18 10:55:25 +02:00
DynamicLoader.cpp LibELF: Fix calculation for TLS relocations 2021-04-19 12:14:43 +02:00
DynamicLoader.h LibELF: Fix support for relocating weak symbols 2021-04-19 12:00:40 +02:00
DynamicObject.cpp LibELF: Improve error message for missing symbols 2021-04-19 12:00:40 +02:00
DynamicObject.h LibC+LibELF: Implement support for the dl_iterate_phdr helper 2021-04-18 10:55:25 +02:00
Hashes.h LibELF: Move ELF hash functions to their own file (and make constexpr) 2021-02-23 19:43:44 +01:00
Image.cpp LibELF: Convert more string literals to StringView literals. 2021-02-24 14:45:34 +01:00
Image.h LibC+LibELF: Implement support for the dl_iterate_phdr helper 2021-04-18 10:55:25 +02:00
Validation.cpp LibC+LibELF: Implement support for the dl_iterate_phdr helper 2021-04-18 10:55:25 +02:00
Validation.h LibC+LibELF: Implement support for the dl_iterate_phdr helper 2021-04-18 10:55:25 +02:00