[PATCH v4 0/5] Add tests for Guarded Control Stack
Yury Khrustalev
yury.khrustalev@arm.com
Mon Feb 10 11:45:33 GMT 2025
This patch adds AArch64 specific tests related to Guarded Control Stack [1].
It also adds new configure checks for linker support for the "-z gcs=..."
option and compiler support for "gcs" in branch protection.
The new tests are AArch64 specific. Moreover, they are included only
if compiler supports "gsc" in branch protection and linker supports
the "-z gcs=<value>" option. If enabled and built, these tests will
run on systems with and without HWCAP_GCS. In the latter case the tests
will be reported as UNSUPPORTED.
When runtime target supports GCS, tests are run with all supported
values of the GCS tunable to check its effects.
Regression tested on aarch64 and no regressions have been found. Tested
using toolchains with and without GCS support.
base commit: 6bcd7bf100
OK for trunk?
[1] https://developer.arm.com/documentation/ddi0487/ka/ (chapter D11)
Changes since v3:
- Added check for compiler support of the "gcs" in branch protection.
Link to v3: https://inbox.sourceware.org/libc-alpha/20250129094940.2643944-1-yury.khrustalev@arm.com/
Changes since v2:
- Added configure check for linker support of the "-z gcs=..." option
to only enabled GCS related tests when it makes sense to do so.
- Fixed typos in copyright years in some new files.
Link to v2: https://inbox.sourceware.org/libc-alpha/20250124122858.3788655-1-yury.khrustalev@arm.com/
Changes since v1:
- Fixed test compilation error due to undefine macro GCS_MAGIC.
Link to v1: https://inbox.sourceware.org/libc-alpha/20250123141401.3257507-1-yury.khrustalev@arm.com/
---
Yury Khrustalev (5):
aarch64: Add configure checks for GCS support
aarch64: Add tests for Guarded Control Stack
aarch64: Add GCS tests for transitive dependencies
aarch64: Add GCS tests for dlopen
aarch64: Add GCS test with signal handler
Makeconfig | 2 +-
configure | 99 ++++++++++++++
configure.ac | 17 +++
sysdeps/unix/sysv/linux/aarch64/Makefile | 129 +++++++++++++++++-
.../unix/sysv/linux/aarch64/tst-gcs-abort.sh | 40 ++++++
.../linux/aarch64/tst-gcs-disabled-static.c | 1 +
.../sysv/linux/aarch64/tst-gcs-disabled.c | 2 +
.../linux/aarch64/tst-gcs-dlopen-disabled.c | 3 +
.../linux/aarch64/tst-gcs-dlopen-enforced.c | 3 +
.../aarch64/tst-gcs-dlopen-optional-off.c | 3 +
.../aarch64/tst-gcs-dlopen-optional-on.c | 3 +
.../linux/aarch64/tst-gcs-dlopen-override.c | 3 +
.../unix/sysv/linux/aarch64/tst-gcs-dlopen.c | 62 +++++++++
.../linux/aarch64/tst-gcs-enforced-abort.c | 2 +
.../aarch64/tst-gcs-enforced-static-abort.c | 1 +
.../linux/aarch64/tst-gcs-enforced-static.c | 1 +
.../sysv/linux/aarch64/tst-gcs-enforced.c | 2 +
.../unix/sysv/linux/aarch64/tst-gcs-helper.h | 39 ++++++
.../unix/sysv/linux/aarch64/tst-gcs-mod1.c | 27 ++++
.../unix/sysv/linux/aarch64/tst-gcs-mod2.c | 25 ++++
.../unix/sysv/linux/aarch64/tst-gcs-mod3.c | 25 ++++
.../sysv/linux/aarch64/tst-gcs-noreturn.c | 100 ++++++++++++++
.../sysv/linux/aarch64/tst-gcs-optional-off.c | 2 +
.../sysv/linux/aarch64/tst-gcs-optional-on.c | 2 +
.../aarch64/tst-gcs-optional-static-off.c | 1 +
.../aarch64/tst-gcs-optional-static-on.c | 1 +
.../linux/aarch64/tst-gcs-override-static.c | 1 +
.../sysv/linux/aarch64/tst-gcs-override.c | 2 +
.../linux/aarch64/tst-gcs-shared-disabled.c | 2 +
.../aarch64/tst-gcs-shared-enforced-abort.c | 2 +
.../linux/aarch64/tst-gcs-shared-optional.c | 2 +
.../linux/aarch64/tst-gcs-shared-override.c | 2 +
.../unix/sysv/linux/aarch64/tst-gcs-shared.c | 41 ++++++
.../sysv/linux/aarch64/tst-gcs-skeleton.c | 43 ++++++
34 files changed, 688 insertions(+), 2 deletions(-)
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-abort.sh
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-disabled-static.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-disabled.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-dlopen-disabled.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-dlopen-enforced.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-dlopen-optional-off.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-dlopen-optional-on.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-dlopen-override.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-dlopen.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-enforced-abort.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-enforced-static-abort.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-enforced-static.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-enforced.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-helper.h
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-mod1.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-mod2.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-mod3.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-noreturn.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-optional-off.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-optional-on.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-optional-static-off.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-optional-static-on.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-override-static.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-override.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-shared-disabled.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-shared-enforced-abort.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-shared-optional.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-shared-override.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-shared.c
create mode 100644 sysdeps/unix/sysv/linux/aarch64/tst-gcs-skeleton.c
--
2.39.5
More information about the Libc-alpha
mailing list