aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-03-22 09:58:42 +0000
committerAlan Hayward <alan.hayward@arm.com>2019-03-22 09:58:42 +0000
commit6dc0ebde59dfb73eae507ced718bafa54023bf33 (patch)
tree9cc851b66b4b94d633e576f1b955edfe9b63d81c
parent968aa7ae389d9e6cecb5fda6826bf889ed959fce (diff)
downloadgdb-6dc0ebde59dfb73eae507ced718bafa54023bf33.zip
gdb-6dc0ebde59dfb73eae507ced718bafa54023bf33.tar.gz
gdb-6dc0ebde59dfb73eae507ced718bafa54023bf33.tar.bz2
AArch64: Add pointer authentication feature
Pointer Authentication is a new feature in AArch64 v8.3-a. When enabled in the compiler, function return addresses will be mangled by the kernel. Add register description xml and wire up to aarch64_linux_read_description. This description includes the two pauth user registers. Nothing yet uses the feature - that is added in later patches. gdb/ChangeLog: * aarch64-linux-nat.c (aarch64_linux_nat_target::read_description): Add pauth param. * aarch64-linux-tdep.c (aarch64_linux_core_read_description): Likewise. * aarch64-tdep.c (struct target_desc): Add in pauth. (aarch64_read_description): Add pauth param. (aarch64_gdbarch_init): Likewise. * aarch64-tdep.h (aarch64_read_description): Likewise. * arch/aarch64.c (aarch64_create_target_description): Likewise. * arch/aarch64.h (aarch64_create_target_description): Likewise. * features/Makefile: Add new files. * features/aarch64-pauth.c: New file. * features/aarch64-pauth.xml: New file. gdb/doc/ChangeLog: * gdb.texinfo: Describe pauth feature. gdb/gdbserver/ChangeLog: * linux-aarch64-ipa.c (get_ipa_tdesc): Add pauth param. (initialize_low_tracepoint): Likewise. * linux-aarch64-low.c (aarch64_arch_setup): Likewise. * linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Likewise. * linux-aarch64-tdesc.c (struct target_desc): Likewise. (aarch64_linux_read_description): Likewise. * linux-aarch64-tdesc.h (aarch64_linux_read_description): Likewise.
-rw-r--r--gdb/ChangeLog17
-rw-r--r--gdb/aarch64-linux-nat.c5
-rw-r--r--gdb/aarch64-linux-tdep.c4
-rw-r--r--gdb/aarch64-tdep.c14
-rw-r--r--gdb/aarch64-tdep.h2
-rw-r--r--gdb/arch/aarch64.c6
-rw-r--r--gdb/arch/aarch64.h5
-rw-r--r--gdb/doc/ChangeLog5
-rw-r--r--gdb/doc/gdb.texinfo3
-rw-r--r--gdb/features/Makefile1
-rw-r--r--gdb/features/aarch64-pauth.c16
-rw-r--r--gdb/features/aarch64-pauth.xml13
-rw-r--r--gdb/gdbserver/ChangeLog11
-rw-r--r--gdb/gdbserver/linux-aarch64-ipa.c8
-rw-r--r--gdb/gdbserver/linux-aarch64-low.c3
-rw-r--r--gdb/gdbserver/linux-aarch64-tdesc-selftest.c2
-rw-r--r--gdb/gdbserver/linux-aarch64-tdesc.c10
-rw-r--r--gdb/gdbserver/linux-aarch64-tdesc.h2
18 files changed, 101 insertions, 26 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 4345e01..743f510 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,20 @@
+2019-03-22 Alan Hayward <alan.hayward@arm.com>
+ Jiong Wang <jiong.wang@arm.com>
+
+ * aarch64-linux-nat.c
+ (aarch64_linux_nat_target::read_description): Add pauth param.
+ * aarch64-linux-tdep.c
+ (aarch64_linux_core_read_description): Likewise.
+ * aarch64-tdep.c (struct target_desc): Add in pauth.
+ (aarch64_read_description): Add pauth param.
+ (aarch64_gdbarch_init): Likewise.
+ * aarch64-tdep.h (aarch64_read_description): Likewise.
+ * arch/aarch64.c (aarch64_create_target_description): Likewise.
+ * arch/aarch64.h (aarch64_create_target_description): Likewise.
+ * features/Makefile: Add new files.
+ * features/aarch64-pauth.c: New file.
+ * features/aarch64-pauth.xml: New file.
+
2019-03-20 Tom Tromey <tromey@adacore.com>
* infrun.c (handle_inferior_event): Rename from
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 6f91e95..f58a41e 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -605,8 +605,9 @@ aarch64_linux_nat_target::read_description ()
ret = ptrace (PTRACE_GETREGSET, tid, NT_ARM_VFP, &iovec);
if (ret == 0)
return tdesc_arm_with_neon;
- else
- return aarch64_read_description (aarch64_sve_get_vq (tid));
+
+ /* pauth not yet supported. */
+ return aarch64_read_description (aarch64_sve_get_vq (tid), false);
}
/* Convert a native/host siginfo object, into/from the siginfo in the
diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
index 39e6076..445019a 100644
--- a/gdb/aarch64-linux-tdep.c
+++ b/gdb/aarch64-linux-tdep.c
@@ -640,7 +640,9 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch,
if (target_auxv_search (target, AT_HWCAP, &aarch64_hwcap) != 1)
return NULL;
- return aarch64_read_description (aarch64_linux_core_read_vq (gdbarch, abfd));
+ /* pauth not yet supported. */
+ return aarch64_read_description (aarch64_linux_core_read_vq (gdbarch, abfd),
+ false);
}
/* Implementation of `gdbarch_stap_is_single_operand', as defined in
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index dd57ef9..0518837 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -69,7 +69,7 @@
#define HA_MAX_NUM_FLDS 4
/* All possible aarch64 target descriptors. */
-struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1];
+struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/];
/* The standard register names, and all the valid aliases for them. */
static const struct
@@ -2885,18 +2885,18 @@ aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch,
(It is not possible to set VQ to zero on an SVE system). */
const target_desc *
-aarch64_read_description (uint64_t vq)
+aarch64_read_description (uint64_t vq, bool pauth_p)
{
if (vq > AARCH64_MAX_SVE_VQ)
error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq,
AARCH64_MAX_SVE_VQ);
- struct target_desc *tdesc = tdesc_aarch64_list[vq];
+ struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p];
if (tdesc == NULL)
{
- tdesc = aarch64_create_target_description (vq);
- tdesc_aarch64_list[vq] = tdesc;
+ tdesc = aarch64_create_target_description (vq, pauth_p);
+ tdesc_aarch64_list[vq][pauth_p] = tdesc;
}
return tdesc;
@@ -2961,7 +2961,7 @@ aarch64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* Ensure we always have a target description. */
if (!tdesc_has_registers (tdesc))
- tdesc = aarch64_read_description (0);
+ tdesc = aarch64_read_description (0, false);
gdb_assert (tdesc);
feature_core = tdesc_find_feature (tdesc, "org.gnu.gdb.aarch64.core");
@@ -3190,7 +3190,7 @@ When on, AArch64 specific debugging is enabled."),
selftests::register_test ("aarch64-process-record",
selftests::aarch64_process_record_test);
selftests::record_xml_tdesc ("aarch64.xml",
- aarch64_create_target_description (0));
+ aarch64_create_target_description (0, false));
#endif
}
diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h
index 704eacb..3db6bee 100644
--- a/gdb/aarch64-tdep.h
+++ b/gdb/aarch64-tdep.h
@@ -89,7 +89,7 @@ struct gdbarch_tdep
}
};
-const target_desc *aarch64_read_description (uint64_t vq);
+const target_desc *aarch64_read_description (uint64_t vq, bool pauth_p);
extern int aarch64_process_record (struct gdbarch *gdbarch,
struct regcache *regcache, CORE_ADDR addr);
diff --git a/gdb/arch/aarch64.c b/gdb/arch/aarch64.c
index d36ed9d..11a15dd 100644
--- a/gdb/arch/aarch64.c
+++ b/gdb/arch/aarch64.c
@@ -22,11 +22,12 @@
#include "../features/aarch64-core.c"
#include "../features/aarch64-fpu.c"
#include "../features/aarch64-sve.c"
+#include "../features/aarch64-pauth.c"
/* See arch/aarch64.h. */
target_desc *
-aarch64_create_target_description (uint64_t vq)
+aarch64_create_target_description (uint64_t vq, bool pauth_p)
{
target_desc *tdesc = allocate_target_description ();
@@ -43,5 +44,8 @@ aarch64_create_target_description (uint64_t vq)
else
regnum = create_feature_aarch64_sve (tdesc, regnum, vq);
+ if (pauth_p)
+ regnum = create_feature_aarch64_pauth (tdesc, regnum);
+
return tdesc;
}
diff --git a/gdb/arch/aarch64.h b/gdb/arch/aarch64.h
index 807a4a6..4fe6d02 100644
--- a/gdb/arch/aarch64.h
+++ b/gdb/arch/aarch64.h
@@ -24,9 +24,10 @@
/* Create the aarch64 target description. A non zero VQ value indicates both
the presence of SVE and the Vector Quotient - the number of 128bit chunks in
- an SVE Z register. */
+ an SVE Z register. HAS_PAUTH_P indicates the presence of the PAUTH
+ feature. */
-target_desc *aarch64_create_target_description (uint64_t vq);
+target_desc *aarch64_create_target_description (uint64_t vq, bool has_pauth_p);
/* Register numbers of various important registers.
Note that on SVE, the Z registers reuse the V register numbers and the V
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 447d74e..1f41498 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-22 Alan Hayward <alan.hayward@arm.com>
+ Jiong Wang <jiong.wang@arm.com>
+
+ * gdb.texinfo (AArch64 Features): Describe pauth feature.
+
2019-03-20 Tom Tromey <tromey@adacore.com>
* python.texi (Selecting Pretty-Printers): Use @defvar for
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 271739b..4c1d5e8 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -43162,6 +43162,9 @@ The @samp{org.gnu.gdb.aarch64.sve} feature is optional. If present,
it should contain registers @samp{z0} through @samp{z31}, @samp{p0}
through @samp{p15}, @samp{ffr} and @samp{vg}.
+The @samp{org.gnu.gdb.aarch64.pauth} feature is optional. If present,
+it should contain registers @samp{pauth_dmask} and @samp{pauth_cmask}.
+
@node ARC Features
@subsection ARC Features
@cindex target descriptions, ARC Features
diff --git a/gdb/features/Makefile b/gdb/features/Makefile
index 3d84ca0..d0cd4f8 100644
--- a/gdb/features/Makefile
+++ b/gdb/features/Makefile
@@ -227,6 +227,7 @@ $(outdir)/%.dat: %.xml number-regs.xsl sort-regs.xsl gdbserver-regs.xsl
FEATURE_XMLFILES = aarch64-core.xml \
aarch64-fpu.xml \
+ aarch64-pauth.xml \
i386/32bit-core.xml \
i386/32bit-sse.xml \
i386/32bit-linux.xml \
diff --git a/gdb/features/aarch64-pauth.c b/gdb/features/aarch64-pauth.c
new file mode 100644
index 0000000..e4b84ff
--- /dev/null
+++ b/gdb/features/aarch64-pauth.c
@@ -0,0 +1,16 @@
+/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
+ Original: aarch64-pauth.xml */
+
+#include "common/tdesc.h"
+
+static int
+create_feature_aarch64_pauth (struct target_desc *result, long regnum)
+{
+ struct tdesc_feature *feature;
+
+ feature = tdesc_create_feature (result, "org.gnu.gdb.aarch64.pauth");
+ tdesc_create_reg (feature, "pauth_dmask", regnum++, 1, NULL, 64, "int");
+ tdesc_create_reg (feature, "pauth_cmask", regnum++, 1, NULL, 64, "int");
+
+ return regnum;
+}
diff --git a/gdb/features/aarch64-pauth.xml b/gdb/features/aarch64-pauth.xml
new file mode 100644
index 0000000..9c8987f
--- /dev/null
+++ b/gdb/features/aarch64-pauth.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2018 Free Software Foundation, Inc.
+
+ Copying and distribution of this file, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. -->
+
+<!DOCTYPE feature SYSTEM "gdb-target.dtd">
+<feature name="org.gnu.gdb.aarch64.pauth">
+ <reg name="pauth_dmask" bitsize="64"/>
+ <reg name="pauth_cmask" bitsize="64"/>
+</feature>
+
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 9879481..9fdbe1d 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,14 @@
+2019-03-22 Alan Hayward <alan.hayward@arm.com>
+ Jiong Wang <jiong.wang@arm.com>
+
+ * linux-aarch64-ipa.c (get_ipa_tdesc): Add pauth param.
+ (initialize_low_tracepoint): Likewise.
+ * linux-aarch64-low.c (aarch64_arch_setup): Likewise.
+ * linux-aarch64-tdesc-selftest.c (aarch64_tdesc_test): Likewise.
+ * linux-aarch64-tdesc.c (struct target_desc): Likewise.
+ (aarch64_linux_read_description): Likewise.
+ * linux-aarch64-tdesc.h (aarch64_linux_read_description): Likewise.
+
2019-03-12 John Baldwin <jhb@FreeBSD.org>
* linux-x86-tdesc.c (i386_linux_read_description): Update call to
diff --git a/gdb/gdbserver/linux-aarch64-ipa.c b/gdb/gdbserver/linux-aarch64-ipa.c
index 94db53f..3804b1e 100644
--- a/gdb/gdbserver/linux-aarch64-ipa.c
+++ b/gdb/gdbserver/linux-aarch64-ipa.c
@@ -147,12 +147,12 @@ get_raw_reg (const unsigned char *raw_regs, int regnum)
/* Return target_desc to use for IPA, given the tdesc index passed by
gdbserver. Index is ignored, since we have only one tdesc
- at the moment. SVE not yet supported. */
+ at the moment. SVE and pauth not yet supported. */
const struct target_desc *
get_ipa_tdesc (int idx)
{
- return aarch64_linux_read_description (0);
+ return aarch64_linux_read_description (0, false);
}
/* Allocate buffer for the jump pads. The branch instruction has a reach
@@ -204,6 +204,6 @@ alloc_jump_pad_buffer (size_t size)
void
initialize_low_tracepoint (void)
{
- /* SVE not yet supported. */
- aarch64_linux_read_description (0);
+ /* SVE and pauth not yet supported. */
+ aarch64_linux_read_description (0, false);
}
diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c
index 0b2946e..db329da 100644
--- a/gdb/gdbserver/linux-aarch64-low.c
+++ b/gdb/gdbserver/linux-aarch64-low.c
@@ -501,7 +501,8 @@ aarch64_arch_setup (void)
if (is_elf64)
{
uint64_t vq = aarch64_sve_get_vq (tid);
- current_process ()->tdesc = aarch64_linux_read_description (vq);
+ /* pauth not yet supported. */
+ current_process ()->tdesc = aarch64_linux_read_description (vq, false);
}
else
current_process ()->tdesc = tdesc_arm_with_neon;
diff --git a/gdb/gdbserver/linux-aarch64-tdesc-selftest.c b/gdb/gdbserver/linux-aarch64-tdesc-selftest.c
index 1b2453a..bf24a27 100644
--- a/gdb/gdbserver/linux-aarch64-tdesc-selftest.c
+++ b/gdb/gdbserver/linux-aarch64-tdesc-selftest.c
@@ -29,7 +29,7 @@ namespace tdesc {
static void
aarch64_tdesc_test ()
{
- const target_desc *tdesc = aarch64_linux_read_description (0);
+ const target_desc *tdesc = aarch64_linux_read_description (0, false);
SELF_CHECK (*tdesc == *tdesc_aarch64);
}
}
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.c b/gdb/gdbserver/linux-aarch64-tdesc.c
index 6ab473e..6f9b4f1 100644
--- a/gdb/gdbserver/linux-aarch64-tdesc.c
+++ b/gdb/gdbserver/linux-aarch64-tdesc.c
@@ -24,22 +24,22 @@
#include <inttypes.h>
/* All possible aarch64 target descriptors. */
-struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1];
+struct target_desc *tdesc_aarch64_list[AARCH64_MAX_SVE_VQ + 1][2/*pauth*/];
/* Create the aarch64 target description. */
const target_desc *
-aarch64_linux_read_description (uint64_t vq)
+aarch64_linux_read_description (uint64_t vq, bool pauth_p)
{
if (vq > AARCH64_MAX_SVE_VQ)
error (_("VQ is %" PRIu64 ", maximum supported value is %d"), vq,
AARCH64_MAX_SVE_VQ);
- struct target_desc *tdesc = tdesc_aarch64_list[vq];
+ struct target_desc *tdesc = tdesc_aarch64_list[vq][pauth_p];
if (tdesc == NULL)
{
- tdesc = aarch64_create_target_description (vq);
+ tdesc = aarch64_create_target_description (vq, pauth_p);
static const char *expedite_regs_aarch64[] = { "x29", "sp", "pc", NULL };
static const char *expedite_regs_aarch64_sve[] = { "x29", "sp", "pc",
@@ -50,7 +50,7 @@ aarch64_linux_read_description (uint64_t vq)
else
init_target_desc (tdesc, expedite_regs_aarch64_sve);
- tdesc_aarch64_list[vq] = tdesc;
+ tdesc_aarch64_list[vq][pauth_p] = tdesc;
}
return tdesc;
diff --git a/gdb/gdbserver/linux-aarch64-tdesc.h b/gdb/gdbserver/linux-aarch64-tdesc.h
index 7ce8150..06b3ec9 100644
--- a/gdb/gdbserver/linux-aarch64-tdesc.h
+++ b/gdb/gdbserver/linux-aarch64-tdesc.h
@@ -20,7 +20,7 @@
#ifndef GDBSERVER_LINUX_AARCH64_TDESC_H
#define GDBSERVER_LINUX_AARCH64_TDESC_H
-const target_desc * aarch64_linux_read_description (uint64_t vq);
+const target_desc * aarch64_linux_read_description (uint64_t vq, bool pauth_p);
#if GDB_SELF_TEST
void initialize_low_tdesc ();