Skip to content
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
merged 2 commits into from
Mar 7, 2024

Conversation

pratlucas
Copy link
Contributor

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

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>
@pratlucas
Copy link
Contributor Author

aadwarf64/aadwarf64.rst Outdated Show resolved Hide resolved
aadwarf64/aadwarf64.rst Outdated Show resolved Hide resolved
aadwarf64/aadwarf64.rst Show resolved Hide resolved
@stuij stuij merged commit 879df44 into ARM-software:main Mar 7, 2024
1 check passed
Copy link

@sallyarmneale sallyarmneale left a 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants