From: Aurelien Jarno <aurelien@aurel32.net>
To: libc-alpha@sourceware.org
Cc: "H . J . Lu" <hjl.tools@gmail.com>,
Aurelien Jarno <aurelien@aurel32.net>
Subject: [PATCH] x86_64/cet: fix tst-shstk-legacy-1{f,g} tests [BZ #31877]
Date: Sat, 12 Sep 2026 13:34:20 +0200 [thread overview]
Message-ID: <20260912113420.3723703-1-aurelien@aurel32.net> (raw)
The tst-shstk-legacy-1f and tst-shstk-legacy-1g tests depend on the
tst-shstk-legacy-mod-1.so module to test that legacy shadow stack code
in init_array does not trigger a segfault in tst-shstk-legacy-1f, while
it does trigger a segfault in tst-shstk-legacy-1g. However, the module
is built but never loaded by the tests.
Load it using LD_PRELOAD. When glibc is configured with --enable-cet,
this allows tst-shstk-legacy-1g to pass on systems with kernel and
hardware support for shadow stacks.
---
sysdeps/x86_64/Makefile | 2 +-
sysdeps/x86_64/tst-shstk-legacy-1g.sh | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/sysdeps/x86_64/Makefile b/sysdeps/x86_64/Makefile
index ff0463d7ca..688b537a48 100644
--- a/sysdeps/x86_64/Makefile
+++ b/sysdeps/x86_64/Makefile
@@ -466,7 +466,7 @@ $(objpfx)tst-shstk-legacy-1e-static.out: \
$(objpfx)tst-shstk-legacy-1e-static
$(SHELL) $< $(common-objpfx) 2> $@; \
$(evaluate-test)
-tst-shstk-legacy-1f-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK
+tst-shstk-legacy-1f-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK LD_PRELOAD=$(objpfx)tst-shstk-legacy-mod-1.so
$(objpfx)tst-shstk-legacy-1f: $(objpfx)tst-shstk-legacy-mod-1.so
$(objpfx)tst-shstk-legacy-mod-1.so: \
$(objpfx)tst-shstk-legacy-mod-1.os \
diff --git a/sysdeps/x86_64/tst-shstk-legacy-1g.sh b/sysdeps/x86_64/tst-shstk-legacy-1g.sh
index 449bf7493b..0453e3d3af 100755
--- a/sysdeps/x86_64/tst-shstk-legacy-1g.sh
+++ b/sysdeps/x86_64/tst-shstk-legacy-1g.sh
@@ -22,6 +22,7 @@ common_objpfx=$1; shift
test_program_prefix=$1; shift
GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \
+LD_PRELOAD=${common_objpfx}elf/tst-shstk-legacy-mod-1.so \
${test_program_prefix} \
${common_objpfx}elf/tst-shstk-legacy-1g
# The exit status should only be unsupported (77) or segfault (139).
--
2.53.0
next reply other threads:[~2026-09-12 11:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 11:34 Aurelien Jarno [this message]
2026-09-15 23:41 ` H.J. Lu
2026-09-16 15:30 ` Yury Khrustalev
2026-09-16 17:23 ` Aurelien Jarno
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260912113420.3723703-1-aurelien@aurel32.net \
--to=aurelien@aurel32.net \
--cc=hjl.tools@gmail.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).