Skip to content

Add support for AArch64 Pointer Authentication ABI in Rust #148640

Open

Description

@asl

Recently there were efforts in LLVM mainline intended for:

As a result, LLVM 21 has more or less complete support for pointer authentication features for ELF targets (MachoO bits are still not there, so there is no full arm64e ABI support).

This is a tracking issue to add support for pointer authentication to Rust basing on the existing LLVM support.

Overall, everything could be split into 3 subtasks:

  • Add support for extern "C" function pointers. This invokes both calling them via signed function pointers from Rust case as well as providing properly authenticated extern "C" Rust functions to be called from pauth-enabled C code. We'd need to support type-discriminated function pointers here as well, so few bits of signing scheme should be either reimplemented in rustc or imported from elsewhere (e.g. clang). The support should be based on Linux pauthtest ABI and could be further adopted by interested platforms. Overall the pauth itself support seems to be simple, it is just some boilerplate glue code that requires to be written.
  • Same as above but for C++ functions. This might be much more elaborated as C++ pointer authentication ABI relies on many implementations details (and could be dependent on the chosen signing scheme)
  • Develop pointer authentication ABI for Rust code. This would require development of Rust Pointer Authentication ABI and certainly would require an RFC.

I want to explicitly mention that the primary target would be ELF-based platforms. There is no intention to support arm64e (so this issue is a bit orthogonal to #73628) simply because there is no full LLVM mainline support for this ABI at the time of writing. Still, I'd anticipate that implementing the pauth for ELF platforms would allow straightforward implementation of arm64e ABI if / when LLVM mainline would support it – likely some lightweight plumbing of settings and options.

References:

Activity

  1. added
    needs-triage
    on Nov 7, 2025
  2. asl commented on Nov 7, 2025

    @asl
    Author

    Tagging @jchlanda

  3. asl commented on Nov 7, 2025

    @asl
    Author

    And to further clarify the things: we are going to implement at least first two of aforementioned subtasks

  4. workingjubilee commented on Nov 7, 2025

    @workingjubilee
    Member

    @asl Hrm. How do you intend to determine when to use the C vs. C++ variants (assuming I am understanding correctly that they can differ) from Rust code? I believe from Rust's perspective there is only extern "C" and funny-looking extern "C", so the two aren't clearly differentiated.

  5. changed the title [-]Add support for AArch64 pointer authentication in Rust[/-] [+]Add support for AArch64 Pointer Authentication ABI in Rust[/+] on Nov 7, 2025
  6. added
    O-AArch64
    A-ABI
    on Nov 7, 2025
  7. davidtwco commented on Nov 7, 2025

    @davidtwco
    Member

    I've renamed this issue to "Pointer Authentication ABI" to distinguish it from the existing Pointer Authentication support tracked in #113369.

  8. added
    T-compiler
    C-feature-request
    and removed
    needs-triage
    on Nov 7, 2025
  9. asl commented on Nov 7, 2025

    @asl
    Author

    @asl Hrm. How do you intend to determine when to use the C vs. C++ variants (assuming I am understanding correctly that they can differ) from Rust code? I believe from Rust's perspective there is only extern "C" and funny-looking extern "C", so the two aren't clearly differentiated.

    This is something we'd need to figure out & design :) I guess funny-looking extern C will use type discrimination and should be resigned to a proper C++-aware discriminator when "crossing" to C++ world.

  10. workingjubilee commented on Nov 7, 2025

    @workingjubilee
    Member

    I see!

    One possible option that requires increased Rust support is to attach an attribute to the declaration of the function... like so:

    unsafe extern "C" {
        #[your_paint_choice_here]
        fn something_from_cpp();
    }

    and teach rust-bindgen to emit that attribute when it is binding C++ code. This would handle a lot of practical uses, I think, since it is common to use it for binding code.

    Adding an extern "C++" ABI is another option that offers more direct support and is not technically impossible, but raises a lot of questions that may make it overly costly as a route, depending.

  11. asl commented on Nov 7, 2025

    @asl
    Author

    and teach rust-bindgen to emit that attribute when it is binding C++ code. This would handle a lot of practical uses, I think, since it is common to use it for binding code.

    My immediate thought is to try to support, say, cxx::bridge only and see what changes / plumbing would be required. Likely this would allow us to have C++ bits for free (as there is code generated there and compiled by pauth-aware host compiler).

  12. jchlanda commented on Jun 1, 2026

    @jchlanda
    Contributor
  13. added 4 commits that reference this issue on Jun 29, 2026
  14. added a commit that references this issue on Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ABIC-feature-requestO-AArch64T-compiler

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions