diff options
author | Alan Hayward <alan.hayward@arm.com> | 2019-08-07 09:47:57 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2019-08-07 13:34:12 +0100 |
commit | 3d31bc39e655ea39721754fa0ea539a8a0c9b26c (patch) | |
tree | ec7bbfffea5a3d18b20acf0bf5162e48b1db1af3 /gdb/arch | |
parent | fca8e23c31e6ec37bdcb5cf1d981a39d1e6fb6f6 (diff) | |
download | gdb-3d31bc39e655ea39721754fa0ea539a8a0c9b26c.zip gdb-3d31bc39e655ea39721754fa0ea539a8a0c9b26c.tar.gz gdb-3d31bc39e655ea39721754fa0ea539a8a0c9b26c.tar.bz2 |
AArch64 pauth: Indicate unmasked addresses in backtrace
Armv8.3-a Pointer Authentication causes the function return address to be
obfuscated on entry to some functions. GDB must unmask the link register in
order to produce a backtrace.
The following patch adds markers of [PAC] to the bracktrace, to indicate
which addresses needed unmasking. This includes the backtrace when using MI.
For example, consider the following backtrace:
(gdb) bt
0 0x0000000000400490 in puts@plt ()
1 0x00000000004005dc in foo ("hello") at cbreak-lib.c:6
2 0x0000000000400604 [PAC] in bar () at cbreak-lib.c:12
3 0x0000000000400620 [PAC] in main2 () at cbreak.c:17
4 0x00000000004005b4 in main () at cbreak-3.c:10
The functions in cbreak-lib use pointer auth, which masks the return address
to the previous function, causing the addresses of bar (in the library) and main2
(in the main binary) to require unmasking in order to unwind the backtrace.
An extra bool is added alongside the prev_pc in the frame structure. At the
point at which the link register is unmasked, the AArch64 port calls into frame
to sets the bool. This is the most efficient way of doing it.
The marker is also added to the python frame printer, which is always printed if
set. The marker is not explicitly exposed to the python code.
I expect this will potentially cause issues with some tests in the testsuite
when Armv8.3 pointer authentication is used. This should be fixed up in the
the future once real hardware is available for full testsuite testing.
gdb/ChangeLog:
* NEWS: Expand the Pointer Authentication entry.
* aarch64-tdep.c (aarch64_frame_unmask_address): Rename from this.
(aarch64_frame_unmask_lr): ... to this.
(aarch64_prologue_prev_register, aarch64_dwarf2_prev_register):
Call aarch64_frame_unmask_lr.
* frame.c (struct frame_info): Add "masked" variable.
(frame_set_previous_pc_masked) (frame_get_pc_masked): New functions.
(fprint_frame): Check for masked pc.
* frame.h (frame_set_previous_pc_masked) (frame_get_pc_masked): New
declarations.
* python/py-framefilter.c (py_print_frame): Check for masked pc.
* stack.c (print_frame): Check for masked pc.
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): New subsection.
Diffstat (limited to 'gdb/arch')
0 files changed, 0 insertions, 0 deletions