[PATCH v3 0/4] aarch64: Support enforcing BTI
Yury Khrustalev
yury.khrustalev@arm.com
Wed Nov 26 16:45:53 GMT 2025
Current behaviour on AArch64 targets that support Branch Target
Authentication (BTI) allows to load a dependency that is not
BTI-marked. It is useful to support another behaviour when loading
a dependency without BTI-marking results in an error. To allow
switching between these modes, we add a new Glibc tunable called
glibc.cpu.aarch64_bti.
The default value 0 of this tunable corresponds to existing behaviour
and we label this value as "permissive". To enforce BTI protection,
the process should be started with the value 1 of this tunable. In
such a case all dependencies loaded by the dynamic loader will have
to be correctly marked, otherwise the process will be aborted. If an
unmarked module is loaded via dlopen(), an error will be returned and
such module will not be loaded.
To facilitate testing, we need to add new configure checks.
---
Passes regression in AArch64. OK for trunk?
Base commit: bc4bc1650b
---
Changes in v3:
- Changed configure check that determines if BTI protection
is available (similar to GCS checks from [1]). No need to
deal with autoconf preprocessor macros.
- v2: https://inbox.sourceware.org/libc-alpha/20251119163521.2065210-1-yury.khrustalev@arm.com/
Changes in v2:
- Fixed several things based on upstream feedback.
- Added new configure check for a macro defined by a compiler
to check if BTI branch protection was enabled.
- v1: https://inbox.sourceware.org/libc-alpha/20251031153704.3883875-1-yury.khrustalev@arm.com/
[1]: https://inbox.sourceware.org/libc-alpha/20251124154157.3560464-1-yury.khrustalev@arm.com/
---
Yury Khrustalev (4):
aarch64: add configure checks for BTI support
aarch64: Add glibc.cpu.aarch64_bti tunable
aarch64: Support enforcing BTI on dependencies
aarch64: add tests for glibc.cpu.aarch64_bti behaviour
manual/tunables.texi | 16 ++
sysdeps/aarch64/Makefile | 58 ++++++-
sysdeps/aarch64/configure | 144 ++++++++++++++++++
sysdeps/aarch64/configure.ac | 36 +++++
sysdeps/aarch64/cpu-features.h | 5 +
sysdeps/aarch64/dl-bti.c | 16 +-
sysdeps/aarch64/dl-tunables.list | 6 +
sysdeps/aarch64/linkmap.h | 1 +
sysdeps/aarch64/tst-bti-abort-imm.c | 3 +
sysdeps/aarch64/tst-bti-abort-transitive.c | 3 +
sysdeps/aarch64/tst-bti-abort-unprot.c | 3 +
sysdeps/aarch64/tst-bti-abort.sh | 39 +++++
sysdeps/aarch64/tst-bti-dep-prot.c | 3 +
sysdeps/aarch64/tst-bti-dlopen-imm.c | 6 +
sysdeps/aarch64/tst-bti-dlopen-prot.c | 6 +
sysdeps/aarch64/tst-bti-dlopen-transitive.c | 6 +
sysdeps/aarch64/tst-bti-mod-prot.c | 13 ++
sysdeps/aarch64/tst-bti-mod-unprot.c | 14 ++
sysdeps/aarch64/tst-bti-mod.c | 27 ++++
sysdeps/aarch64/tst-bti-permissive-dlopen.c | 6 +
sysdeps/aarch64/tst-bti-permissive-imm.c | 3 +
.../aarch64/tst-bti-permissive-transitive.c | 3 +
sysdeps/aarch64/tst-bti-skeleton-dlopen.c | 62 ++++++++
sysdeps/aarch64/tst-bti-skeleton.c | 45 ++++++
.../unix/sysv/linux/aarch64/cpu-features.c | 2 +
sysdeps/unix/sysv/linux/aarch64/dl-procinfo.c | 16 ++
26 files changed, 540 insertions(+), 2 deletions(-)
create mode 100644 sysdeps/aarch64/tst-bti-abort-imm.c
create mode 100644 sysdeps/aarch64/tst-bti-abort-transitive.c
create mode 100644 sysdeps/aarch64/tst-bti-abort-unprot.c
create mode 100644 sysdeps/aarch64/tst-bti-abort.sh
create mode 100644 sysdeps/aarch64/tst-bti-dep-prot.c
create mode 100644 sysdeps/aarch64/tst-bti-dlopen-imm.c
create mode 100644 sysdeps/aarch64/tst-bti-dlopen-prot.c
create mode 100644 sysdeps/aarch64/tst-bti-dlopen-transitive.c
create mode 100644 sysdeps/aarch64/tst-bti-mod-prot.c
create mode 100644 sysdeps/aarch64/tst-bti-mod-unprot.c
create mode 100644 sysdeps/aarch64/tst-bti-mod.c
create mode 100644 sysdeps/aarch64/tst-bti-permissive-dlopen.c
create mode 100644 sysdeps/aarch64/tst-bti-permissive-imm.c
create mode 100644 sysdeps/aarch64/tst-bti-permissive-transitive.c
create mode 100644 sysdeps/aarch64/tst-bti-skeleton-dlopen.c
create mode 100644 sysdeps/aarch64/tst-bti-skeleton.c
--
2.47.3
More information about the Libc-alpha
mailing list