This patch adds support for handling return addresses signed with
pointer authentication. It simply strips the authentication code
without verifying its correctness, and thus works with both A and B
keys and through key-change boundaries.
Additons:
* DW_CFA_AARCH64_negate_ra_state: new CFA operation.
* RA_SIGN_STATE: new pseudo register.
* Pass the arch to DwarfCfa so that the new op is only executed
on aarch64.
The stripping uses the xpaclri instruction. This is a hint space
instruction which is compatible with pre Armv8.3-A devices. For cases
where it cannot be used, a mask can be set instead.
Test: libunwindstack_test
Without this patch all UnwindTest.* testcases should fail if
compiled with Pointer Authentication.
The tests should be executed with both -mbranch-protection=pac-ret and
pac-ret+leaf flags so that either some or all functions have pointer
authentication instructions.
Change-Id: Id7c3f1d0e2fc7fccb19bd1430826264405a9df7c
The backtrace offline code uses these error codes to diagnose errors.
In addtion, I've had cases where seeing these errors would help diagnose
failures.
This also allows us to add a few features to indicate why an unwind
terminated (such as max frames exceeded).
Bug: 65682279
Test: Updated unit tests pass.
Change-Id: If82b5092698e8a194016d670efff1320f9b44d50
- Add namespace unwindstack everywhere so that it's easier for other
code to use the library.
- Move some of the header files into include/unwindstack so that they
can be exposed.
- Modify the headers so that only a limited number need to be exposed.
- Update the tools to use the new headers.
- Add a GetLoadBias() call on the Elf object. This prevents the need
to get the interface object out of the Elf object.
- Move the GetRelPc() call out of the Reg class, to the Elf class. It's
not always the case that a Reg object will be around when you want to
get a relative pc. The tests for this moved to ElfTest.cpp.
Bug: 23762183
Test: Unit tests pass.
Change-Id: Iac609dac1dd90ed83d1a1e24ff2579c96c023bc3