]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
GDB, gdbserver: aarch64-linux: Initial Guarded Control Stack support
authorThiago Jung Bauermann <thiago.bauermann@linaro.org>
Thu, 1 May 2025 21:12:19 +0000 (18:12 -0300)
committerThiago Jung Bauermann <thiago.bauermann@linaro.org>
Wed, 18 Jun 2025 03:21:21 +0000 (00:21 -0300)
commit6e4a39ac3c0ddd036104ab6430d35adf49991c52
tree18c0b09e63add54eacc4b9665e93cfd90a62632b
parent2dae3f253177be4f52f37bb9f9da1aaa6703c0b9
GDB, gdbserver: aarch64-linux: Initial Guarded Control Stack support

Add the org.gnu.gdb.aarch64.gcs feature with the GCSPR register, and the
org.gnu.gdb.aarch64.gcs.linux feature with "registers" to represent the
Linux kernel ptrace and prctl knobs that enable and lock specific GCS
functionality.

This code supports GCS only in Linux userspace applications, so the
GCSPR that is exposed is the one at EL0.

Also, support for calling inferior functions is enabled by adding an
implementation for the shadow_stack_push gdbarch method.

Testcases gdb.arch/aarch64-gcs.exp and gdb.arch/aarch64-gcs-core.exp are
included to cover the added functionality.

The change in the core_find procedure allows aarch64-gcs-core.exp to
recover the output from the crashed program.  It's needed because the
test program in this testcase prints to stdout the value of the GCSPR
right before crashing, and the testcase needs it to check whether GDB
got it right.
18 files changed:
gdb/aarch64-linux-nat.c
gdb/aarch64-linux-tdep.c
gdb/aarch64-tdep.c
gdb/aarch64-tdep.h
gdb/arch/aarch64-gcs-linux.h [new file with mode: 0644]
gdb/arch/aarch64.c
gdb/arch/aarch64.h
gdb/features/Makefile
gdb/features/aarch64-gcs-linux.c [new file with mode: 0644]
gdb/features/aarch64-gcs-linux.xml [new file with mode: 0644]
gdb/features/aarch64-gcs.c [new file with mode: 0644]
gdb/features/aarch64-gcs.xml [new file with mode: 0644]
gdb/testsuite/gdb.arch/aarch64-gcs-core.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/aarch64-gcs-core.exp [new file with mode: 0644]
gdb/testsuite/gdb.arch/aarch64-gcs.c [new file with mode: 0644]
gdb/testsuite/gdb.arch/aarch64-gcs.exp [new file with mode: 0644]
gdb/testsuite/lib/gdb.exp
gdbserver/linux-aarch64-low.cc