| Message ID | 20260529162818.3749464-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 [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 94F324BA23C9 for <patchwork@sourceware.org>; Fri, 29 May 2026 16:29:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94F324BA23C9 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=ERpIQ4z9 X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by sourceware.org (Postfix) with ESMTPS id 2059D4BA23E6 for <libc-alpha@sourceware.org>; Fri, 29 May 2026 16:28:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2059D4BA23E6 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 2059D4BA23E6 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::f31 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780072104; cv=none; b=ScmOixfFHYrwfRMirSVw220qSeak2VMlH+NWD49RW/bg0z5mgKc9+nuRWAIh/+kT1Aq/TEjgXul3bhN6R0xqJnWA9gyitzv3SWhghR2GnAkhW8nqAUTpQKSz5410m9ftBJ/XBJV1nCDwhQ9KkyAcNjyZ4Hbt2jPQbcnWFo5/Fw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780072104; c=relaxed/simple; bh=pOacc7qVnRsBd5to6vInzm4xd6OSUGz+PgZ7iGvFeGc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=e2dSEngZFy3gR8aZRdNjZHp1sgx03SzPpQIkEKQSl2UTVEco3RXS1v+MUIXpKNdrIT3FInuPp0UjhYKU4a0GgHE+DPeuMKy7y4FiOx2h+DG0nSGCAzbXgiq/MiBLCRm0Z28Mg67OmO70s34J1ZiuFrgesixZkEDROHh6UXHAU78= ARC-Authentication-Results: i=1; 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=ERpIQ4z9 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2059D4BA23E6 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-8ccef25789fso1810236d6.3 for <libc-alpha@sourceware.org>; Fri, 29 May 2026 09:28:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1780072103; x=1780676903; 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=k+KqquNMMFt+InFWC1Q7vTeRRZiHoIPVfwfs/04+PyU=; b=ERpIQ4z9JxkMp6IKLC/Knt5YLwPZYCNt493AsF+WX2yvMgx+rHWcrX12AVJYPrm8Fq Vg57RoccgyeNWELsCU/M3hayhmYE2dfgvr4Oi93du/bcZ3YcL4X8/hH0SScjTvNmOBdt s4i4LsCB3ZF7uup9SFK4QG6UV8ia+sUrgChe31fye4kc+Xf4PBjzgheoZnDihP3XxjB3 FRrVI2wals2R01czEZUJmnhEbYGBjHBe7g+WjVsV7bGBM+inXUM0i0fkhRCN+rNwWO3D pjK2cGoWbSGDkUgkEKY8GV6Sy0tQ8UpgtlVxaB83FsJMi80rhuu66pSclmiLCtSe0uuM Djgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780072103; x=1780676903; 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=k+KqquNMMFt+InFWC1Q7vTeRRZiHoIPVfwfs/04+PyU=; b=Zn7sPyC3MkccRte7yLv6aE0KrcXtMifpIJ3Yu+54PCSaFoofyeNhzxFEdap9JVIADv htEd7GjnRVTOxQ0Vcp1hTt9tDRxPmwXeW2OfDDOHBNLkwPM4c/LGMDj1Ksy+nHNtDWB+ 5bZ4lpiWvjHqCvZ39y3Qe62mioIE9JWYBrzgghtJFb9OyaKrkPlBiwkj+SKiLLyHdgyK Sk2/qiIqxt9QzsRD3okaQJq4jZ5QnfE+ZnOydC3/pGynPg6zc4x6y71CAMztIf/YCnYg D0lUgkk12bZsb0E8ntmI+NRL289Yf29E48djAtOBe/MIry2Zbm8QPnYRJ+wNvhCDIjaW j3kQ== X-Gm-Message-State: AOJu0YzgN8hF8iYHA7kRi0K89eLjo0WQASOW7d4RgxB+RT5cEkadEFpZ zDhkWAAovE2z5LvkbTE6rTMdmsIlzCs/fZxmKovGO4hwAQIHvBQfpWUXXxHyyHUiKDtlax3DFNP PR52N X-Gm-Gg: Acq92OFIZnDCRJwJpypyy4WuZUcC4KKGI/GHbuUbU6KYmTbXkf2fSLVS3+yR2UzU3cZ 19p4xymICf/8rCa7u5ppVtCqF9joTmB1KsOAs0CsmJ+c/1/zUmNndhc8zm34GBXwKuLkKWeu0EY smgGsaroGVguXUzgMrya6T6pPwosfslBTngPYbwhNk5pWzq6IVC4XQOokLmA1+SQ1aAwpyw2ZGR tP1s+VwxcsOtLHrlAHu0TwCXvfpiC1aK15802b5OWgMZ3VH3JbKBp981z93Q6gLvu2BWVqFLvYK AcRjQc9BOV37MxZnpyMbnD9iXNFix2vX1KSsU1j9Kbp8A9BtKa4PYmEmj6s/mc5cxDr+gZV83Sy k5n3NSWa+jeDIo/0ULOuADXX/pPPmnbh4lP6PxrR8/IBZkNvseQ9HnTVsydC7R71TPbZ65oX1jl yxyL2MQVsfL2YSqvL65H0PBDLADscfaEzt0wUHcD6yhksWPw== X-Received: by 2002:a05:620a:1997:b0:914:b5f8:c2b3 with SMTP id af79cd13be357-9153d96a548mr68051285a.18.1780072103443; Fri, 29 May 2026 09:28:23 -0700 (PDT) Received: from mandiga.. ([2804:1b3:a7c2:efc6:96e6:e80e:65cc:b3cd]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9153244c085sm234346985a.6.2026.05.29.09.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 09:28:22 -0700 (PDT) From: Adhemerval Zanella <adhemerval.zanella@linaro.org> To: libc-alpha@sourceware.org Cc: Florian Weimer <fweimer@redhat.com> Subject: [PATCH v9 0/5] elf: Allow RPATH/RUNPATH for static-pie Date: Fri, 29 May 2026 13:26:39 -0300 Message-ID: <20260529162818.3749464-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, URIBL_BLOCKED shortcircuit=no 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
May 29, 2026, 4:26 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.
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 | 30 +++++++++++
elf/dl-load.c | 2 +-
elf/dl-minimal.c | 8 ---
elf/dl-reloc-static-pie.c | 2 +-
elf/get-dynamic-info.h | 5 +-
elf/rtld.c | 4 +-
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/signal.h | 3 ++
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 +++----
.../lp64/multiarch/dl-symbol-redir-ifunc.h | 2 +
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 +
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 | 8 +++
.../x86_64/multiarch/dl-symbol-redir-ifunc.h | 22 ++++++++
45 files changed, 548 insertions(+), 81 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 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/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