mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-11-16 12:34:43 +00:00
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. If for some reason a target description contains the org.gnu.gdb.aarch64.gcs feature but not the org.gnu.gdb.aarch64.gcs.linux feature then GCS support is disabled and GDB continues the debugging session. Features that need GCS support (for example, calling inferior functions) will not work and the inferior will get a segmentation fault signal instead. There's a testcase for this scenario but it only checks the native debugging case, even though in practice this problem would only occur in remote debugging with a broken stub or gdbserver. I tested manually with a gdbserver hacked to send a broken target description and it worked as described. Testcases gdb.arch/aarch64-gcs.exp, gdb.arch/aarch64-gcs-core.exp and gdb.arch/aarch64-gcs-wrong-tdesc.exp are included to cover the added functionality. Reviewed-By: Christina Schimpe <christina.schimpe@intel.com> Approved-By: Luis Machado <luis.machado@arm.com>
22 lines
862 B
C
22 lines
862 B
C
/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
|
|
Original: aarch64-gcs-linux.xml */
|
|
|
|
#include "gdbsupport/tdesc.h"
|
|
|
|
static int
|
|
create_feature_aarch64_gcs_linux (struct target_desc *result, long regnum)
|
|
{
|
|
struct tdesc_feature *feature;
|
|
|
|
feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.gcs.linux");
|
|
tdesc_type_with_fields *type_with_fields;
|
|
type_with_fields = tdesc_create_flags (feature, "features_flags", 8);
|
|
tdesc_add_flag (type_with_fields, 0, "PR_SHADOW_STACK_ENABLE");
|
|
tdesc_add_flag (type_with_fields, 1, "PR_SHADOW_STACK_WRITE");
|
|
tdesc_add_flag (type_with_fields, 2, "PR_SHADOW_STACK_PUSH");
|
|
|
|
tdesc_create_reg (feature, "gcs_features_enabled", regnum++, 1, "system", 64, "features_flags");
|
|
tdesc_create_reg (feature, "gcs_features_locked", regnum++, 1, "system", 64, "features_flags");
|
|
return regnum;
|
|
}
|