mbox series

[0/4] Avoid malloc symbol interposition in the dynamic loader [BZ #25486]

Message ID cover.1581182210.git.fweimer@redhat.com
Headers show
Series Avoid malloc symbol interposition in the dynamic loader [BZ #25486] | expand

Message

Florian Weimer Feb. 8, 2020, 7 p.m. UTC
I initially wanted to close this bug, but Carlos suggested to treat it
as an RFE.  The changes seem a net improvement to me.

This does not completely resolve the issue because we use symbol
interposition for other, more obscure things.

Florian Weimer (4):
  elf: Introduce the rtld-stubbed-symbols makefile variable
  elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.c
  Remove weak declaration of free from <inline-hashtab.h>
  ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]

 elf/Makefile                                  |  26 +++--
 elf/Versions                                  |   3 -
 elf/dl-lookup.c                               |   4 +-
 elf/dl-minimal.c                              |  96 +++++++++++++---
 elf/dl-sym-post.h                             | 106 ++++++++++++++++++
 elf/dl-sym.c                                  |  86 +-------------
 elf/rtld.c                                    |  12 ++
 include/inline-hashtab.h                      |  15 +--
 include/libc-symbols.h                        |   9 +-
 include/malloc.h                              |   2 +
 include/rtld-malloc.h                         |  85 ++++++++++++++
 include/stdlib.h                              |   2 +
 sysdeps/generic/localplt.data                 |   6 -
 sysdeps/mach/hurd/i386/ld.abilist             |   4 -
 sysdeps/mach/hurd/i386/localplt.data          |   6 -
 sysdeps/unix/sysv/linux/aarch64/ld.abilist    |   4 -
 sysdeps/unix/sysv/linux/aarch64/localplt.data |   6 -
 sysdeps/unix/sysv/linux/alpha/ld.abilist      |   4 -
 sysdeps/unix/sysv/linux/alpha/localplt.data   |   6 -
 sysdeps/unix/sysv/linux/arm/be/ld.abilist     |   4 -
 sysdeps/unix/sysv/linux/arm/le/ld.abilist     |   4 -
 sysdeps/unix/sysv/linux/arm/localplt.data     |   6 -
 sysdeps/unix/sysv/linux/csky/ld.abilist       |   4 -
 sysdeps/unix/sysv/linux/csky/localplt.data    |   6 -
 sysdeps/unix/sysv/linux/hppa/ld.abilist       |   4 -
 sysdeps/unix/sysv/linux/hppa/localplt.data    |   6 -
 sysdeps/unix/sysv/linux/i386/ld.abilist       |   4 -
 sysdeps/unix/sysv/linux/i386/localplt.data    |   6 -
 sysdeps/unix/sysv/linux/ia64/ld.abilist       |   4 -
 sysdeps/unix/sysv/linux/ia64/localplt.data    |   6 -
 .../unix/sysv/linux/m68k/coldfire/ld.abilist  |   4 -
 .../sysv/linux/m68k/coldfire/localplt.data    |   6 -
 .../unix/sysv/linux/m68k/m680x0/ld.abilist    |   4 -
 .../unix/sysv/linux/m68k/m680x0/localplt.data |   6 -
 sysdeps/unix/sysv/linux/microblaze/ld.abilist |   4 -
 .../unix/sysv/linux/microblaze/localplt.data  |   6 -
 .../unix/sysv/linux/mips/mips32/ld.abilist    |   4 -
 .../sysv/linux/mips/mips64/n32/ld.abilist     |   4 -
 .../sysv/linux/mips/mips64/n64/ld.abilist     |   4 -
 sysdeps/unix/sysv/linux/nios2/ld.abilist      |   4 -
 sysdeps/unix/sysv/linux/nios2/localplt.data   |   6 -
 .../linux/powerpc/powerpc32/fpu/localplt.data |   6 -
 .../sysv/linux/powerpc/powerpc32/ld.abilist   |   4 -
 .../powerpc/powerpc32/nofpu/localplt.data     |   6 -
 .../linux/powerpc/powerpc64/be/ld.abilist     |   4 -
 .../linux/powerpc/powerpc64/le/ld.abilist     |   4 -
 .../linux/powerpc/powerpc64/localplt.data     |   6 -
 sysdeps/unix/sysv/linux/riscv/localplt.data   |   6 -
 sysdeps/unix/sysv/linux/riscv/rv64/ld.abilist |   4 -
 sysdeps/unix/sysv/linux/s390/localplt.data    |   6 -
 .../unix/sysv/linux/s390/s390-32/ld.abilist   |   4 -
 .../unix/sysv/linux/s390/s390-64/ld.abilist   |   4 -
 sysdeps/unix/sysv/linux/sh/be/ld.abilist      |   4 -
 sysdeps/unix/sysv/linux/sh/le/ld.abilist      |   4 -
 sysdeps/unix/sysv/linux/sh/localplt.data      |   6 -
 .../unix/sysv/linux/sparc/sparc32/ld.abilist  |   4 -
 .../sysv/linux/sparc/sparc32/localplt.data    |   6 -
 .../unix/sysv/linux/sparc/sparc64/ld.abilist  |   4 -
 .../sysv/linux/sparc/sparc64/localplt.data    |   6 -
 sysdeps/unix/sysv/linux/x86_64/64/ld.abilist  |   4 -
 sysdeps/unix/sysv/linux/x86_64/x32/ld.abilist |   4 -
 sysdeps/x86_64/localplt.data                  |   6 -
 62 files changed, 326 insertions(+), 364 deletions(-)
 create mode 100644 elf/dl-sym-post.h
 create mode 100644 include/rtld-malloc.h

Comments

Carlos O'Donell Feb. 14, 2020, 10:36 p.m. UTC | #1
On 2/8/20 2:00 PM, Florian Weimer wrote:
> I initially wanted to close this bug, but Carlos suggested to treat it
> as an RFE.  The changes seem a net improvement to me.
> 
> This does not completely resolve the issue because we use symbol
> interposition for other, more obscure things.
> 
> Florian Weimer (4):
>   elf: Introduce the rtld-stubbed-symbols makefile variable
>   elf: Extract _dl_sym_post, _dl_sym_find_caller_map from elf/dl-sym.c
>   Remove weak declaration of free from <inline-hashtab.h>
>   ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486]

Thank you for the cleanup and improvement!

Overall the architecture of the design looks good to me.

I really like the new explicit handover!
Lucas A. M. Magalhaes Feb. 17, 2020, 12:25 p.m. UTC | #2
Hi,
I've tested this patchset on a ppc64le and result as expected.  Test
io/tst-lchmod is expected to fail and is already being solved in other
patchset.

Test Summary:
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
FAIL: io/tst-lchmod
UNSUPPORTED: math/test-fesetexcept-traps
UNSUPPORTED: math/test-fexcept-traps
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: nptl/test-cond-printers
UNSUPPORTED: nptl/test-condattr-printers
UNSUPPORTED: nptl/test-mutex-printers
UNSUPPORTED: nptl/test-mutexattr-printers
UNSUPPORTED: nptl/test-rwlock-printers
UNSUPPORTED: nptl/test-rwlockattr-printers
UNSUPPORTED: posix/tst-spawn4-compat
Summary of test results:
      1 FAIL
   5127 PASS
     10 UNSUPPORTED
     17 XFAIL
      2 XPASS

Thanks,
Lucas A. M. Magalhães