-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[aadwarf64] Add DWARF support for unwinding with FEAT_PAuth_LR enabled #245
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This introduces DWARF support to enable unwinders to authenticate return addresses signed using FEAT_PAuth_LR, where the value of PC is used as an extra diversifier. To achieve that, this proposes the following changes to the aadwarf64 document: * Expanding usage of the `RA_SIGN_STATE` pseudo-register, allocating it's bit[1] to indicate wether the value of PC has been used for return address signing. * Introducing a new vendor call frame instruction, `DW_CFA_AARCH64_negate_ra_state_with_pc`, which negates both bit[0] and bit[1] of `RA_SIGN_STATE` and instructs the unwinder to capture the current code location to be used when authenticating the return address. Co-authored-by: Oliver Stannard <oliver.stannard@arm.com>
DanielKristofKiss
approved these changes
Feb 26, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No changes required.
Stylie777
added a commit
to Stylie777/llvm-project
that referenced
this pull request
Oct 14, 2024
This introduces support for unwinding programs where return addresses have been signed using FEAT_PAuth_Lr, where the value of PC is used as a diversifier (-mbranch-protection=pac-ret+pc). A new vendor specific call frame instruction is added, named `DW_CFA_AARCH64_negate_ra_state_with_pc`, to instruct the unwinder tocapture the value of PC at the point of signing and update bit 1 of the existing `RA_SIGN_STATE` pseudo-register to flag the need to use it for authentication. See ARM-software/abi-aa#245 for the ABI change. Authored-by: pratlucas <lucas.prates@arm.com>
Stylie777
added a commit
to Stylie777/llvm-project
that referenced
this pull request
Oct 14, 2024
This introduces compiler and dwarfdump support for emitting and parsing the new `DW_CFA_AARCH64_negate_ra_state_with_pc` DWARF instruction for FEAT_PAuth_LR. This does mean that, when using FEAT_PAuthLR, the improvements introduced in llvm#96337 cannot be utilised. `.cfi_negate_ra_state_with_pc` must be emitted directly after the signing instruction, and when bundled with other CFI calls, leads to faults when running a program. There are no changes seen when not using FEAT_PAuthLR to how the CFI Instructions are generated. See ARM-software/abi-aa#245 for the ABI change that incororates FEAT_PAuthLR. Authored-by: pratlucas <lucas.prates@arm.com> Co-authored by: vhscampos <victor.campos@arm.com> Co-authored by: Stylie777 <jack.styles@arm.com>
Stylie777
added a commit
to Stylie777/llvm-project
that referenced
this pull request
Oct 14, 2024
This introduces support for unwinding programs where return addresses have been signed using FEAT_PAuth_Lr, where the value of PC is used as a diversifier (-mbranch-protection=pac-ret+pc). A new vendor specific call frame instruction is added, named `DW_CFA_AARCH64_negate_ra_state_with_pc`, to instruct the unwinder tocapture the value of PC at the point of signing and update bit 1 of the existing `RA_SIGN_STATE` pseudo-register to flag the need to use it for authentication. See ARM-software/abi-aa#245 for the ABI change. Authored-by: pratlucas <lucas.prates@arm.com>
Stylie777
added a commit
to Stylie777/llvm-project
that referenced
this pull request
Oct 14, 2024
This introduces compiler and dwarfdump support for emitting and parsing the new `DW_CFA_AARCH64_negate_ra_state_with_pc` DWARF instruction for FEAT_PAuth_LR. This does mean that, when using FEAT_PAuthLR, the improvements introduced in llvm#96337 cannot be utilised. `.cfi_negate_ra_state_with_pc` must be emitted directly after the signing instruction, and when bundled with other CFI calls, leads to faults when running a program. There are no changes seen when not using FEAT_PAuthLR to how the CFI Instructions are generated. See ARM-software/abi-aa#245 for the ABI change that incororates FEAT_PAuthLR. Authored-by: pratlucas <lucas.prates@arm.com> Co-authored by: vhscampos <victor.campos@arm.com> Co-authored by: Stylie777 <jack.styles@arm.com>
Stylie777
added a commit
to Stylie777/llvm-project
that referenced
this pull request
Oct 16, 2024
This introduces support for unwinding programs where return addresses have been signed using FEAT_PAuth_Lr, where the value of PC is used as a diversifier (-mbranch-protection=pac-ret+pc). A new vendor specific call frame instruction is added, named `DW_CFA_AARCH64_negate_ra_state_with_pc`, to instruct the unwinder tocapture the value of PC at the point of signing and update bit 1 of the existing `RA_SIGN_STATE` pseudo-register to flag the need to use it for authentication. See ARM-software/abi-aa#245 for the ABI change. Authored-by: pratlucas <lucas.prates@arm.com>
Stylie777
added a commit
to Stylie777/llvm-project
that referenced
this pull request
Oct 16, 2024
This introduces compiler and dwarfdump support for emitting and parsing the new `DW_CFA_AARCH64_negate_ra_state_with_pc` DWARF instruction for FEAT_PAuth_LR. This does mean that, when using FEAT_PAuthLR, the improvements introduced in llvm#96337 cannot be utilised. `.cfi_negate_ra_state_with_pc` must be emitted directly after the signing instruction, and when bundled with other CFI calls, leads to faults when running a program. There are no changes seen when not using FEAT_PAuthLR to how the CFI Instructions are generated. See ARM-software/abi-aa#245 for the ABI change that incororates FEAT_PAuthLR. Authored-by: pratlucas <lucas.prates@arm.com> Co-authored by: vhscampos <victor.campos@arm.com> Co-authored by: Stylie777 <jack.styles@arm.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This introduces DWARF support to enable unwinders to authenticate return
addresses signed using FEAT_PAuth_LR, where the value of PC is used as
an extra diversifier.
To achieve that, this proposes the following changes to the aadwarf64
document:
RA_SIGN_STATE
pseudo-register, allocatingit's bit[1] to indicate wether the value of PC has been used for
return address signing.
DW_CFA_AARCH64_negate_ra_state_with_pc
, which negates both bit[0]and bit[1] of
RA_SIGN_STATE
and instructs the unwinder to capturethe current code location to be used when authenticating the return
address.
Co-authored-by: Oliver Stannard oliver.stannard@arm.com