From: German Gomez <german.gomez@arm.com>
To: elfutils-devel@sourceware.org
Subject: [PATCH 1/4] aarch64: Create definitions for AARCH64_RA_SIGN_STATE register
Date: Mon, 25 Apr 2022 14:03:08 +0000 [thread overview]
Message-ID: <20220425140311.95231-2-german.gomez@arm.com> (raw)
In-Reply-To: <20220425140311.95231-1-german.gomez@arm.com>
This register will be used to indicate whether a return address is
mangled with a PAC or not, in accordance with the DWARF AARCH64 ABI [1].
[1] https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#41dwarf-register-names
Signed-off-by: German Gomez <german.gomez@arm.com>
---
backends/aarch64_init.c | 6 +++---
backends/aarch64_initreg.c | 2 ++
backends/aarch64_regs.c | 5 ++++-
libdw/dwarf.h | 5 +++++
tests/run-addrcfi.sh | 1 +
tests/run-allregs.sh | 1 +
6 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/backends/aarch64_init.c b/backends/aarch64_init.c
index bed92954..0a3a2c79 100644
--- a/backends/aarch64_init.c
+++ b/backends/aarch64_init.c
@@ -55,10 +55,10 @@ aarch64_init (Elf *elf __attribute__ ((unused)),
HOOK (eh, data_marker_symbol);
HOOK (eh, abi_cfi);
- /* X0-X30 (31 regs) + SP + 1 Reserved + ELR, 30 Reserved regs (34-43)
+ /* X0-X30 (31 regs) + SP + 1 Reserved + ELR + RA_SIGN_STATE, 30 Reserved regs (34-43)
+ V0-V31 (32 regs, least significant 64 bits only)
- + ALT_FRAME_RETURN_COLUMN (used when LR isn't used) = 97 DWARF regs. */
- eh->frame_nregs = 97;
+ + ALT_FRAME_RETURN_COLUMN (used when LR isn't used) = 98 DWARF regs. */
+ eh->frame_nregs = 98;
HOOK (eh, set_initial_registers_tid);
HOOK (eh, unwind);
diff --git a/backends/aarch64_initreg.c b/backends/aarch64_initreg.c
index daf6f375..4661068a 100644
--- a/backends/aarch64_initreg.c
+++ b/backends/aarch64_initreg.c
@@ -73,6 +73,8 @@ aarch64_set_initial_registers_tid (pid_t tid __attribute__ ((unused)),
/* ELR cannot be found. */
+ /* RA_SIGN_STATE cannot be found */
+
/* FP registers (only 64bits are used). */
struct user_fpsimd_struct fregs;
iovec.iov_base = &fregs;
diff --git a/backends/aarch64_regs.c b/backends/aarch64_regs.c
index 23014bfc..e95ece37 100644
--- a/backends/aarch64_regs.c
+++ b/backends/aarch64_regs.c
@@ -87,7 +87,10 @@ aarch64_register_info (Ebl *ebl __attribute__ ((unused)),
case 33:
return regtype ("integer", DW_ATE_address, "elr");
- case 34 ... 63:
+ case 34:
+ return regtype ("integer", DW_ATE_unsigned, "ra_sign_state");
+
+ case 35 ... 63:
return 0;
case 64 ... 95:
diff --git a/libdw/dwarf.h b/libdw/dwarf.h
index 3ce7f236..f234c411 100644
--- a/libdw/dwarf.h
+++ b/libdw/dwarf.h
@@ -1011,6 +1011,11 @@ enum
DW_EH_PE_indirect = 0x80
};
+/* AARCH64 DWARF registers. */
+enum
+ {
+ DW_AARCH64_RA_SIGN_STATE = 34
+ };
/* DWARF XXX. */
#define DW_ADDR_none 0
diff --git a/tests/run-addrcfi.sh b/tests/run-addrcfi.sh
index 64fa24d7..ce9e753e 100755
--- a/tests/run-addrcfi.sh
+++ b/tests/run-addrcfi.sh
@@ -3639,6 +3639,7 @@ dwarf_cfi_addrframe (.eh_frame): no matching address range
integer reg30 (x30): same_value
integer reg31 (sp): location expression: call_frame_cfa stack_value
integer reg33 (elr): undefined
+ integer reg34 (ra_sign_state): undefined
FP/SIMD reg64 (v0): undefined
FP/SIMD reg65 (v1): undefined
FP/SIMD reg66 (v2): undefined
diff --git a/tests/run-allregs.sh b/tests/run-allregs.sh
index 87b16c95..ed086651 100755
--- a/tests/run-allregs.sh
+++ b/tests/run-allregs.sh
@@ -2693,6 +2693,7 @@ integer registers:
30: x30 (x30), signed 64 bits
31: sp (sp), address 64 bits
33: elr (elr), address 64 bits
+ 34: ra_sign_state (ra_sign_state), unsigned 64 bits
FP/SIMD registers:
64: v0 (v0), unsigned 128 bits
65: v1 (v1), unsigned 128 bits
--
2.25.1
next prev parent reply other threads:[~2022-04-25 14:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-25 14:03 [PATCH 0/4] Add AARCH64 pointer authentication support German Gomez
2022-04-25 14:03 ` German Gomez [this message]
2023-02-23 16:22 ` [PATCH 1/4] aarch64: Create definitions for AARCH64_RA_SIGN_STATE register Mark Wielaard
2022-04-25 14:03 ` [PATCH 2/4] libdw, aarch64: Implement DW_CFA_AARCH64_negate_ra_state CFI instruction German Gomez
2023-02-23 16:27 ` Mark Wielaard
2022-04-25 14:03 ` [PATCH 3/4] libdwfl, aarch64: Demangle return addresses using a PAC mask German Gomez
2022-04-25 14:03 ` [PATCH 4/4] libdwfl, eu-stack, aarch64: Add API for setting AARCH64 " German Gomez
2022-04-28 19:56 ` [PATCH 0/4] Add AARCH64 pointer authentication support Mark Wielaard
2022-05-19 13:30 ` German Gomez
2022-05-19 14:20 ` German Gomez
2023-02-24 0:17 ` Mark Wielaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220425140311.95231-2-german.gomez@arm.com \
--to=german.gomez@arm.com \
--cc=elfutils-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).