diff options
author | Florian Weimer <fweimer@redhat.com> | 2022-11-03 09:39:31 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2022-11-03 09:39:31 +0100 |
commit | ee1ada1bdb8074de6e1bdc956ab19aef7b6a7872 (patch) | |
tree | 4e70dfcb1c076da10542c08d7e0b3900a0a34adc /sysdeps/mach | |
parent | f4ce325dfc50e13cf8240424fa0561fca78e72e7 (diff) | |
download | glibc-ee1ada1bdb8074de6e1bdc956ab19aef7b6a7872.tar.gz glibc-ee1ada1bdb8074de6e1bdc956ab19aef7b6a7872.tar.xz glibc-ee1ada1bdb8074de6e1bdc956ab19aef7b6a7872.zip |
elf: Rework exception handling in the dynamic loader [BZ #25486]
The old exception handling implementation used function interposition to replace the dynamic loader implementation (no TLS support) with the libc implementation (TLS support). This results in problems if the link order between the dynamic loader and libc is reversed (bug 25486). The new implementation moves the entire implementation of the exception handling functions back into the dynamic loader, using THREAD_GETMEM and THREAD_SETMEM for thread-local data support. These depends on Hurd support for these macros, added in commit b65a82e4e757c1e6cb7073916 ("hurd: Add THREAD_GET/SETMEM/_NC"). One small obstacle is that the exception handling facilities are used before the TCB has been set up, so a check is needed if the TCB is available. If not, a regular global variable is used to store the exception handling information. Also rename dl-error.c to dl-catch.c, to avoid confusion with the dlerror function. Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'sysdeps/mach')
-rw-r--r-- | sysdeps/mach/hurd/i386/localplt.data | 5 | ||||
-rw-r--r-- | sysdeps/mach/hurd/i386/tls.h | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/sysdeps/mach/hurd/i386/localplt.data b/sysdeps/mach/hurd/i386/localplt.data index fdff008abd..c01e4d81e4 100644 --- a/sysdeps/mach/hurd/i386/localplt.data +++ b/sysdeps/mach/hurd/i386/localplt.data @@ -8,11 +8,6 @@ libc.so: free + REL R_386_GLOB_DAT libc.so: malloc + REL R_386_GLOB_DAT libc.so: realloc + REL R_386_GLOB_DAT libm.so: matherr + REL R_386_GLOB_DAT -# The TLS-enabled version of these functions is interposed from libc.so. -ld.so: _dl_signal_error + REL R_386_GLOB_DAT -ld.so: _dl_catch_error + REL R_386_GLOB_DAT -ld.so: _dl_signal_exception + REL R_386_GLOB_DAT -ld.so: _dl_catch_exception + REL R_386_GLOB_DAT # The dynamic linker has its own versions of basic functions for initial loading # of shared libraries. These need to be overriden by libc once loaded. ld.so: __open ? diff --git a/sysdeps/mach/hurd/i386/tls.h b/sysdeps/mach/hurd/i386/tls.h index 3817b7230d..602bacc0de 100644 --- a/sysdeps/mach/hurd/i386/tls.h +++ b/sysdeps/mach/hurd/i386/tls.h @@ -48,6 +48,9 @@ typedef struct compatible with the i386 Linux version. */ mach_port_t reply_port; /* This thread's reply port. */ struct hurd_sigstate *_hurd_sigstate; + + /* Used by the exception handling implementation in the dynamic loader. */ + struct rtld_catch *rtld_catch; } tcbhead_t; /* Return tcbhead_t from a TLS segment descriptor. */ |