From 3a0ecccb599a6b1ad4b149dc569c0080e92d057b Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sat, 8 Feb 2020 19:58:43 +0100 Subject: ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] Exporting functions and relying on symbol interposition from libc.so makes the choice of implementation dependent on DT_NEEDED order, which is not what some compiler drivers expect. This commit replaces one magic mechanism (symbol interposition) with another one (preprocessor-/compiler-based redirection). This makes the hand-over from the minimal malloc to the full malloc more explicit. Removing the ABI symbols is backwards-compatible because libc.so is always in scope, and the dynamic loader will find the malloc-related symbols there since commit f0b2132b35248c1f4a80f62a2c38cddcc802aa8c ("ld.so: Support moving versioned symbols between sonames [BZ #24741]"). Reviewed-by: Carlos O'Donell --- sysdeps/unix/sysv/linux/i386/ld.abilist | 4 ---- sysdeps/unix/sysv/linux/i386/localplt.data | 6 ------ 2 files changed, 10 deletions(-) (limited to 'sysdeps/unix/sysv/linux/i386') diff --git a/sysdeps/unix/sysv/linux/i386/ld.abilist b/sysdeps/unix/sysv/linux/i386/ld.abilist index edb7307228..0478e22071 100644 --- a/sysdeps/unix/sysv/linux/i386/ld.abilist +++ b/sysdeps/unix/sysv/linux/i386/ld.abilist @@ -1,8 +1,4 @@ GLIBC_2.0 _r_debug D 0x14 -GLIBC_2.0 calloc F -GLIBC_2.0 free F -GLIBC_2.0 malloc F -GLIBC_2.0 realloc F GLIBC_2.1 __libc_stack_end D 0x4 GLIBC_2.1 _dl_mcount F GLIBC_2.3 ___tls_get_addr F diff --git a/sysdeps/unix/sysv/linux/i386/localplt.data b/sysdeps/unix/sysv/linux/i386/localplt.data index f6f20a5d15..5334875b4b 100644 --- a/sysdeps/unix/sysv/linux/i386/localplt.data +++ b/sysdeps/unix/sysv/linux/i386/localplt.data @@ -7,12 +7,6 @@ libc.so: malloc + REL R_386_GLOB_DAT libc.so: memalign + REL R_386_GLOB_DAT libc.so: realloc + REL R_386_GLOB_DAT libm.so: matherr + REL R_386_GLOB_DAT -# The main malloc is interposed into the dynamic linker, for -# allocations after the initial link (when dlopen is used). -ld.so: malloc + REL R_386_GLOB_DAT -ld.so: calloc + REL R_386_GLOB_DAT -ld.so: realloc + REL R_386_GLOB_DAT -ld.so: free + 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 -- cgit 1.4.1