Re: [PATCH v11 0/5] elf: Allow RPATH/RUNPATH for static-pie

Adhemerval Zanella Netto <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Linaro
Message-ID <[email protected]>
Ping.

On 28/07/26 18:13, Adhemerval Zanella wrote:
> Although static binaries do not support rpath (since they lack dynamic
> sections), adding static-pie support only affects the dlopen function.
> It is one less unexpected behavior (where dynamic and static binaries
> support and behave differently), and if/when static dlopen support is
> removed, this will become a no-op.
> 
> The testcase from BZ 33326 triggered a deep issue with an assert in
> startup code, which required changes to multiple ABIs to properly fix
> (even though the assert itself was removed in the last patch). There
> are still other assert usage, although most, if not all, are for
> ill-formatted ELF files.
> 
> Changes from v10:
> * s390: only redirect __strchrnul when the ifunc is built (fixes
>   --disable-multi-arch build).
> * _dl_mmap now issues the syscall directly, since setting errno on
>   failure also requires the thread pointer.
> * Turn stack protection off for mempcpy as well, which is called by
>   __libc_message_impl on targets without an assembly implementation.
> * Dropped the duplicated memcpy (aarch64) and strlen (x86_64)
>   redirections.
> * elf/tst-pie-rpath-static is now a container test. 
> * Fixed the __tunables_init prototype in the new startup test, plus
>   assorted Makefile and comment cleanups.
> 
> Changes from v9:
> * Rebased against master.
> * Added review from previous version.
> 
> Changes from v8:
> * Rebased against master.
> * Added review from previous version.
> 
> Changes from v7:
> * Also raise SIGABRT on assert for ld.so.  The hurd __raise_direct
>   is no-op that requires a proper implementation (so current semantic
>   is kept).
> 
> Changes from v6:
> * Improve comments.
> * Remove unused files.
> 
> Changes from v5:
> * Move _dl_writev and _dl_mmap to their own TU for i386 to avoid
>   I386_USE_SYSENTER redefinition.
> * Fixed generic __raise_direct and add a TODO for Hurd.
> 
> Changes from 4:
> * Rename __raise_nocancel to __raise_direct and remove default
>   implementation.
> * Simplify _dl_writev.
> 
> Changes from v3:
> * Added Wilco's suggestion on fallback implementation for ctz/clz.
> * Rebased against master.
> * Fixed another riscv issues.
> 
> Changes from v2:
> * Fixed a build for x86_64-linux-gnu-v3.
> * Adjust the elf/tst-pie-rpath-static to run correctly when
>   --enable-hardcoded-path-in-tests is not used
> 
> Changes from v1:
> * Change the ctz/clz fallback to simpler algorithms and use a different
>   header/macro with a better explanation of its intend.
> * Rename __pthread_kill_self to __raise_nostatus.
> * Fixed assert also for powerpc-power4 and riscv.
> 
> Adhemerval Zanella (5):
>   nptl: Add __raise_direct
>   Use _dl_writev on __libc_message_impl
>   Fix assert during static startup (BZ 33326)
>   elf: Allow RPATH/RUNPATH for static-pie (BZ 33326)
>   elf: Remove __chk_fail from dl-minimal.c
> 
>  assert/Makefile                               |  5 +++
>  elf/Makefile                                  | 27 ++++++++++++
>  elf/dl-load.c                                 |  2 +-
>  elf/dl-minimal.c                              |  8 ----
>  elf/dl-reloc-static-pie.c                     |  2 +-
>  elf/get-dynamic-info.h                        |  7 +--
>  elf/rtld.c                                    |  4 +-
>  elf/setup-vdso.h                              |  2 +-
>  elf/tst-assert-startup-static.c               | 43 +++++++++++++++++++
>  elf/tst-pie-rpath-mod.c                       | 19 ++++++++
>  elf/tst-pie-rpath-static.c                    | 38 ++++++++++++++++
>  .../tst-pie-rpath-static.script               |  2 +
>  include/signal.h                              |  3 ++
>  include/sys/cdefs.h                           |  1 -
>  libio/Makefile                                |  5 +++
>  nptl/pthread_kill.c                           | 21 +++------
>  stdlib/Makefile                               |  5 +++
>  stdlib/abort.c                                |  2 +-
>  string/Makefile                               | 22 +++++++---
>  .../aarch64/multiarch/dl-symbol-redir-ifunc.h |  2 +-
>  sysdeps/aarch64/multiarch/memcpy_generic.S    |  4 ++
>  sysdeps/generic/dl-mmap.h                     | 37 ++++++++++++++++
>  {elf => sysdeps/generic}/dl-writev.h          | 18 ++++----
>  sysdeps/htl/raise.c                           |  2 +
>  .../lp64/multiarch/dl-symbol-redir-ifunc.h    |  1 +
>  sysdeps/posix/libc_fatal.c                    | 27 +++++++-----
>  sysdeps/posix/raise.c                         |  2 +-
>  .../powerpc32/power4/multiarch/Makefile       |  5 +++
>  .../be/multiarch/dl-symbol-redir-ifunc.h      | 27 ++++++++++++
>  .../le/multiarch/dl-symbol-redir-ifunc.h      |  1 +
>  sysdeps/powerpc/powerpc64/multiarch/Makefile  |  5 ++-
>  sysdeps/s390/Makefile                         |  5 +++
>  .../s390/multiarch/dl-symbol-redir-ifunc.h    |  5 +++
>  sysdeps/s390/string-bitops.h                  | 28 ++++++++++++
>  sysdeps/unix/sysv/linux/Makefile              | 16 +++++++
>  sysdeps/unix/sysv/linux/dl-mmap.h             | 40 +++++++++++++++++
>  sysdeps/unix/sysv/linux/dl-writev.h           | 12 ++----
>  sysdeps/unix/sysv/linux/i386/Makefile         | 14 ++++++
>  sysdeps/unix/sysv/linux/i386/dl-mmap.c        | 38 ++++++++++++++++
>  sysdeps/unix/sysv/linux/i386/dl-mmap.h        | 27 ++++++++++++
>  .../linux/{libc_fatal.c => i386/dl-writev.c}  | 28 ++++++------
>  sysdeps/unix/sysv/linux/i386/dl-writev.h      | 15 ++++---
>  sysdeps/unix/sysv/linux/i386/raise_direct.c   | 26 +++++++++++
>  sysdeps/unix/sysv/linux/raise_direct.c        | 31 +++++++++++++
>  .../unix/sysv/linux/riscv/multiarch/Makefile  | 12 ++++--
>  .../x86_64/multiarch/dl-symbol-redir-ifunc.h  | 18 ++++++--
>  46 files changed, 564 insertions(+), 100 deletions(-)
>  create mode 100644 elf/tst-assert-startup-static.c
>  create mode 100644 elf/tst-pie-rpath-mod.c
>  create mode 100644 elf/tst-pie-rpath-static.c
>  create mode 100644 elf/tst-pie-rpath-static.root/tst-pie-rpath-static.script
>  create mode 100644 sysdeps/generic/dl-mmap.h
>  rename {elf => sysdeps/generic}/dl-writev.h (80%)
>  create mode 100644 sysdeps/powerpc/powerpc64/be/multiarch/dl-symbol-redir-ifunc.h
>  create mode 100644 sysdeps/s390/string-bitops.h
>  create mode 100644 sysdeps/unix/sysv/linux/dl-mmap.h
>  create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.c
>  create mode 100644 sysdeps/unix/sysv/linux/i386/dl-mmap.h
>  rename sysdeps/unix/sysv/linux/{libc_fatal.c => i386/dl-writev.c} (58%)
>  create mode 100644 sysdeps/unix/sysv/linux/i386/raise_direct.c
>  create mode 100644 sysdeps/unix/sysv/linux/raise_direct.c
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.