| Message ID | 20260318193454.2466865-1-adhemerval.zanella@linaro.org (mailing list archive) |
|---|---|
| Headers |
Return-Path: <libc-alpha-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id B1C9C4C31865 for <patchwork@sourceware.org>; Wed, 18 Mar 2026 19:36:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B1C9C4C31865 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=u/hF4+pj X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-dl1-x122a.google.com (mail-dl1-x122a.google.com [IPv6:2607:f8b0:4864:20::122a]) by sourceware.org (Postfix) with ESMTPS id EE2EA4BC89A2 for <libc-alpha@sourceware.org>; Wed, 18 Mar 2026 19:35:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EE2EA4BC89A2 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EE2EA4BC89A2 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::122a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773862501; cv=none; b=ub8ecHlUlxeqMZulFE8Gxu/7i1gpjqakjUGxTEE+h10NLi1VMxujePNHCa5y2ltTuGoGd+7y4wH6m+uqWjEi8SDZ5+vxdGTPErTC3uzS2gAs8HcGoYsyVxj/i+yC6t9EPAvQCDhYHaS4l4rkbAJHpRS8EEJIw8JkM9ce5oNiMCM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1773862501; c=relaxed/simple; bh=LJ260J9xiEQ4ZiU7IgbNAmG7ro63G7cRd3eQSGGwljI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=h1Z6GTn8HY+OPyA552DNJX5+AIUW3UkXOaSD35qKfhKT+nDvcaJA1LlWfidpUtXAdVOgfLjoitT/V5HtCQY2Gc47X2J3jBpoDapFp3THOYJ2ASuqawn7JDp0P4RpXOhQxpENY33vz+S2/qC13bHtExTnl6G3MuneJ/90oTR2dfQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EE2EA4BC89A2 Received: by mail-dl1-x122a.google.com with SMTP id a92af1059eb24-128ef6c4a41so176181c88.1 for <libc-alpha@sourceware.org>; Wed, 18 Mar 2026 12:35:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773862499; x=1774467299; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2LI+1q9X4702US3QOgiN8FwUTNCO8bNig4y0LwpnyMg=; b=u/hF4+pjjZgoD+MIqZmAUb965dVk7KmAdIGfTl0l2/MJPsp/3Gnuux2XSkjIokKeRZ 1+EXg84DQYdkMt7q9mMvQ6/05wHhwqkOQp3kgqDHp1VmcsJPVSg4s5kzdWXhxl0Mmujz XjJKyOFZ1GJtDTtQmN88UW7DEjvVF8SMOtNFo/bo3dfY+CLaWam4jlNpY5HMP1pV0Wn5 iOpXjREwOdjViAgLYnCVdnltoEMGj5HZU7qgU3RAI+QqvpE6OL7+KTDoqhN/F5WjFD/s i87LGHWCW2sWvEPHyi3cHSQyFGxIQjhKHN7Pc+z+T/PLinKCG6eFjBH0ZahIZdpyf3eq ObUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773862499; x=1774467299; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2LI+1q9X4702US3QOgiN8FwUTNCO8bNig4y0LwpnyMg=; b=mcThEB0GX1YC4akDdLCK7SKG+Jsz5jcTp/uTQx4+PGoQOClvaPH5LGl5A6U2h20FB+ k2VBOGg9joVII4+tFUMWk4yGrL1xSkhxXo67qFuDL0Yv8/Agq7+baVVxTxnicAuidck0 +j1LBgm2VFb5go1/NnglfH1S/it6K9uHQNSWKkeDAebsxQeMH3Be38FVA3Lech7xTDo0 HCAXGzr58UraElBqcF6CDecA5v/aiQOG6ndnUkErq8SV9qu35KR0fGsPzPd2H/dfdvXj ZBH41pGDinVBzd5E6EDLiBPsLxj3A1DGt9/IdYbyoCMzk3GIcQVOXr2X1qs9SgBAjLbQ 2avA== X-Gm-Message-State: AOJu0Ywvojfno6zvE5My541i5T+azV6g1r7N6LN8PvuoWXepgMUWzohS KaWlQrtULKSYaTxscgH9N7EnygDDdCCNNAIF/Z9Mq5JzJQ4I83tvtLp/MdVonJrXZDcB0U1Se4u LIHUj X-Gm-Gg: ATEYQzzTj0CMuvZX8GHX1Z/v05c+0HZAJ6w/NhG8p6YCxsrKWk543gBB8zY/sj7CUfJ vhMyHX1Yp1blsWLIxRJeK1eUzwcA0a+CT4L8sUwOjallKSCDFew1DDxqKnWufyf14rvs5u/LvUw mYZ9sbiNjLqYB7N2p/Vg42eFXSR8UO5KxZ9gVevdhSxcsXn/tWkoJMG631cYZIrl5MURFnybkvw DxknyO2+TyDdlFeaUdurOnp525vnCSVyZWmtRNjPmTAO3xtgGruW7G33byuJYOD86/sQroNNi+I FiypU90Ef5RLhcRkmzHOSHXgb2Ti48ARtPLrSpFc5odj/q1EMyIBKm6rWcOiWfFz8LHzscJmLbw w6KySUh2LkGj9cPDrwF8hK3ANN4SwVd2u/xCVPbbaY2pSkHWnv85nNbiZKtB1MCnOk3WPEA2YBM DXj+iD7wPmtEdZlA5uXIj96N0PrFjTsYsHTfk= X-Received: by 2002:a05:7022:6a4:b0:128:d5bd:357f with SMTP id a92af1059eb24-129a70e5ee1mr2133294c88.30.1773862499223; Wed, 18 Mar 2026 12:34:59 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c0:f5a4:2159:38c8:c951:d029]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-129b4147522sm4238937c88.15.2026.03.18.12.34.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Mar 2026 12:34:58 -0700 (PDT) From: Adhemerval Zanella <adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Cc: Florian Weimer <fweimer@redhat.com>, Samuel Thibault <samuel.thibault@ens-lyon.org> Subject: [PATCH v8 0/6] elf: Allow RPATH/RUNPATH for static-pie Date: Wed, 18 Mar 2026 16:34:11 -0300 Message-ID: <20260318193454.2466865-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org |
| Series |
elf: Allow RPATH/RUNPATH for static-pie
|
|
Message
Adhemerval Zanella Netto
March 18, 2026, 7:34 p.m. UTC
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 33236 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.
Chagnes 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 (6):
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
elf: Raise SIGABRT for assert within ld.so
Adhemerval Zanella (6):
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
elf: Raise SIGABRT for assert within ld.so
assert/Makefile | 5 ++
elf/Makefile | 29 +++++-
elf/dl-load.c | 2 +-
elf/dl-minimal.c | 90 +++++++++++++------
elf/dl-reloc-static-pie.c | 2 +-
elf/get-dynamic-info.h | 5 +-
elf/rtld.c | 8 +-
elf/setup-vdso.h | 2 +-
elf/tst-assert-startup-static.c | 40 +++++++++
elf/tst-pie-rpath-mod.c | 19 ++++
elf/tst-pie-rpath-static.c | 52 +++++++++++
include/assert.h | 2 +
include/rtld-assert.h | 55 ++++++++++++
include/rtld-malloc.h | 14 ---
include/signal.h | 3 +
include/stdio.h | 2 +
include/sys/cdefs.h | 1 -
libio/Makefile | 5 ++
nptl/pthread_kill.c | 21 ++---
stdlib/Makefile | 5 ++
string/Makefile | 1 +
.../aarch64/multiarch/dl-symbol-redir-ifunc.h | 1 +
sysdeps/aarch64/multiarch/memcpy_generic.S | 4 +
.../armv7/multiarch/dl-symbol-redir-ifunc.h | 27 ++++++
sysdeps/generic/dl-mmap.h | 34 +++++++
{elf => sysdeps/generic}/dl-writev.h | 18 ++--
sysdeps/generic/ldsodefs.h | 16 ++++
.../lp64/multiarch/dl-symbol-redir-ifunc.h | 2 +
sysdeps/mach/hurd/Makefile | 6 ++
sysdeps/mach/hurd/raise_direct.c | 29 ++++++
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 | 1 +
.../riscv/multiarch/dl-symbol-redir-ifunc.h | 1 +
sysdeps/s390/Makefile | 5 ++
.../s390/multiarch/dl-symbol-redir-ifunc.h | 4 +
sysdeps/s390/string-bitops.h | 27 ++++++
.../sparcv9/multiarch/dl-symbol-redir-ifunc.h | 3 +
.../sparc64/multiarch/dl-symbol-redir-ifunc.h | 3 +
sysdeps/unix/sysv/linux/Makefile | 16 ++++
sysdeps/unix/sysv/linux/dl-writev.h | 12 +--
sysdeps/unix/sysv/linux/i386/Makefile | 14 +++
sysdeps/unix/sysv/linux/i386/dl-mmap.c | 36 ++++++++
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 | 29 ++++++
.../unix/sysv/linux/riscv/multiarch/Makefile | 7 ++
.../x86_64/multiarch/dl-symbol-redir-ifunc.h | 32 +++++++
53 files changed, 731 insertions(+), 117 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 include/rtld-assert.h
create mode 100644 sysdeps/arm/armv7/multiarch/dl-symbol-redir-ifunc.h
create mode 100644 sysdeps/generic/dl-mmap.h
rename {elf => sysdeps/generic}/dl-writev.h (80%)
create mode 100644 sysdeps/mach/hurd/raise_direct.c
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/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