fix(backtrace): Strip pointer auth mask before returning usable IP #319
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
The Arm64e architecture introduces pointer authentication codes to
detect and guard against unexpected changes to pointers in memory. For
most application functions, this is a nice bonus that nobody needs to
think about, however, for a crash reporting library, we need to strip
this extraneous value ahead of time to avoid reporting a stack frame
address which does not align to a function exactly, causing unreadable
stack traces.
PACs work by adding a signature to the higher order bits of a pointer
before it is stored. When the pointer is read, the signature is
validated prior to executing a function. If the signature has been
tampered with, then the app is forced to crash rather than execute
altered code.
Design
Modified the Arm64-specific method for reading the instruction
pointer from a crash context to strip a value prior to reporting the
value.
Tests