Skip to content

[WIP] Introduce aarch64-unknown-linux-pauthtest target#154759

Draft
jchlanda wants to merge 7 commits intorust-lang:mainfrom
jchlanda:jakub/pauthtest
Draft

[WIP] Introduce aarch64-unknown-linux-pauthtest target#154759
jchlanda wants to merge 7 commits intorust-lang:mainfrom
jchlanda:jakub/pauthtest

Conversation

@jchlanda
Copy link
Copy Markdown

@jchlanda jchlanda commented Apr 3, 2026

This PR introduces aarch64-unknown-linux-pauthtest target, that enables
Pointer Authentication Code (PAC) support in Rust on AArch64 ELF based Linux
systems using a pauthtest ABI (provided by LLVM) and pauthtest-enabled sysroot
with custom musl, serving as a reference libc implementation.

Supported features include:

  • authenticating signed function pointers for extern "C" function calls
    (corresponds to -fptrauth-calls included in pauthtest ABI as defined in
    LLVM)
  • signing return address before spilling to stack and authenticating return
    address after restoring from stack for non-leaf functions (corresponds to
    -fptrauth-returns)
  • Trapping if authentication failure is detected and FPAC feature is not present
    (corresponds to -fptrauth-auth-traps)
  • Signing of init/fini array entries with the signing schema defined used for
    pauthtest ABI (corresponding to -fptrauth-init-fini,
    -fptrauth-init-fini-address-discrimination)
  • Non-ABI-affecting indirect control flow hardening features included in
    pauthtest ABI (corresponding to -faarch64-jump-table-hardening,
    -fptrauth-indirect-gotos)
  • signed ELF GOT entries (gated behind -Z pauth_enable_elf_got, off by
    default)

Please note that efforts were made to split the work into individual commits
that encapsulate different areas of the code; however, the commits are not
atomic and cannot be built or tested in isolation.

Useful links:

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 3, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

jchlanda added 3 commits April 4, 2026 17:45
`const_ptr_auth` wraps aroudn `LLVMRustConstPtrAuth`, which provides a
way to decorate a function pointer in `ConstPtrAuth`.
Allow PAC metadata to be passed to `get_fn_addr` and related API
changes.
jchlanda added 4 commits April 4, 2026 17:45
The set of supported attributes is:
function
* "aarch64-jump-table-hardening"
* "ptrauth-auth-traps"
* "ptrauth-calls"
* "ptrauth-indirect-gotos"
* "ptrauth-returns"
module
* "ptrauth-elf-got"
* "ptrauth-sign-personality"
Also:
* update tests to force dynamic library when targetting pauthtest
* various test fixes
* introduce end-to-end tests for pauthtest (in run-make)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc O-unix Operating system: Unix-like S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants