From cf9481724bcb86ad4a86cca7befed74bb9cc15eb Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 29 Dec 2023 08:43:54 -0800 Subject: x86/cet: Run some CET tests with shadow stack When CET is disabled by default, run some CET tests with shadow stack enabled using $ export GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK --- sysdeps/x86/Makefile | 14 ++++++++++++++ sysdeps/x86/tst-shstk-legacy-1e-static.sh | 1 + sysdeps/x86/tst-shstk-legacy-1e.sh | 1 + sysdeps/x86/tst-shstk-legacy-1g.sh | 1 + 4 files changed, 17 insertions(+) diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index 0aafd2a..a49b13c 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -249,6 +249,13 @@ CFLAGS-tst-cet-legacy-10-static.c += -mshstk CFLAGS-tst-cet-legacy-10a.c += -fcf-protection=none CFLAGS-tst-cet-legacy-10a-static.c += -fcf-protection=none +tst-cet-legacy-4-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-6-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10a-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-cet-legacy-10a-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK + CFLAGS-tst-shstk-legacy-1a.c += -fcf-protection=none CFLAGS-tst-shstk-legacy-1a-static.c += -fcf-protection=none CFLAGS-tst-shstk-legacy-1d.c += -fcf-protection=none @@ -288,14 +295,20 @@ tst-cet-legacy-6b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK tst-cet-legacy-9-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK tst-cet-legacy-9-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-IBT,-SHSTK +tst-shstk-legacy-1a-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-shstk-legacy-1a-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1a: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1a-static: $(objpfx)tst-shstk-legacy-1-extra.o +tst-shstk-legacy-1b-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-shstk-legacy-1b-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1b: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1b-static: $(objpfx)tst-shstk-legacy-1-extra.o tst-shstk-legacy-1c-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SHSTK tst-shstk-legacy-1c-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=-SHSTK $(objpfx)tst-shstk-legacy-1c: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1c-static: $(objpfx)tst-shstk-legacy-1-extra.o +tst-shstk-legacy-1d-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK +tst-shstk-legacy-1d-static-ENV = GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK $(objpfx)tst-shstk-legacy-1d: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1d-static: $(objpfx)tst-shstk-legacy-1-extra.o $(objpfx)tst-shstk-legacy-1e: $(objpfx)tst-shstk-legacy-1-extra.o @@ -309,6 +322,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 $(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/tst-shstk-legacy-1e-static.sh b/sysdeps/x86/tst-shstk-legacy-1e-static.sh index e943aec..008c50d 100755 --- a/sysdeps/x86/tst-shstk-legacy-1e-static.sh +++ b/sysdeps/x86/tst-shstk-legacy-1e-static.sh @@ -20,6 +20,7 @@ common_objpfx=$1; shift +GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \ ${common_objpfx}elf/tst-shstk-legacy-1e-static # The exit status should only be unsupported (77) or segfault (139). status=$? diff --git a/sysdeps/x86/tst-shstk-legacy-1e.sh b/sysdeps/x86/tst-shstk-legacy-1e.sh index b0467aa..82f2acb 100755 --- a/sysdeps/x86/tst-shstk-legacy-1e.sh +++ b/sysdeps/x86/tst-shstk-legacy-1e.sh @@ -21,6 +21,7 @@ common_objpfx=$1; shift test_program_prefix=$1; shift +GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \ ${test_program_prefix} \ ${common_objpfx}elf/tst-shstk-legacy-1e # The exit status should only be unsupported (77) or segfault (139). diff --git a/sysdeps/x86/tst-shstk-legacy-1g.sh b/sysdeps/x86/tst-shstk-legacy-1g.sh index c112bf6..261eef7 100755 --- a/sysdeps/x86/tst-shstk-legacy-1g.sh +++ b/sysdeps/x86/tst-shstk-legacy-1g.sh @@ -21,6 +21,7 @@ common_objpfx=$1; shift test_program_prefix=$1; shift +GLIBC_TUNABLES=glibc.cpu.hwcaps=SHSTK \ ${test_program_prefix} \ ${common_objpfx}elf/tst-shstk-legacy-1g # The exit status should only be unsupported (77) or segfault (139). -- cgit v1.1