[PAC] Encoder and hash (1/8) - #159071
Open
jchlanda wants to merge 4 commits into
Open
Conversation
This was referenced Jul 10, 2026
jchlanda
force-pushed
the
jakub/pac_ty_disc_PR_1
branch
2 times, most recently
from
July 14, 2026 07:26
bca55be to
8cf67b9
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jchlanda
force-pushed
the
jakub/pac_ty_disc_PR_1
branch
from
July 14, 2026 08:51
8cf67b9 to
7ee3f2c
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
jchlanda
force-pushed
the
jakub/pac_ty_disc_PR_1
branch
from
July 17, 2026 07:01
7ee3f2c to
fdd1189
Compare
This comment has been minimized.
This comment has been minimized.
jchlanda
force-pushed
the
jakub/pac_ty_disc_PR_1
branch
from
July 17, 2026 09:46
d798449 to
4c1b0ac
Compare
kovdan01
reviewed
Jul 20, 2026
Contributor
Author
Done in: 5e05159 |
jchlanda
force-pushed
the
jakub/pac_ty_disc_PR_1
branch
2 times, most recently
from
July 24, 2026 15:29
03337eb to
8b0e0ca
Compare
jchlanda
marked this pull request as ready for review
July 24, 2026 18:07
Collaborator
|
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb |
jchlanda
force-pushed
the
jakub/pac_ty_disc_PR_1
branch
from
August 17, 2026 08:33
4d926ed to
415f5ad
Compare
Collaborator
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
davidtwco
approved these changes
Aug 19, 2026
Member
|
@bors r+ |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Aug 19, 2026
…=davidtwco [PAC] Encoder and hash (1/8) This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used for pointer authentication. Compatibility with Clang is a primary design goal. For a given extern "C" function type, the discriminator produced by Rust must match the value computed by Clang so that function pointers can be exchanged safely between Rust and C code while preserving pointer authentication semantics. The implementation mirrors Clang's behavior in ASTContext::encodeTypeForFunctionPointerAuth, ensuring that identical C-compatible function types produce identical discriminators. See: https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3. --- This is part 1 of a sequence of 8 PRs that together implement support for function pointer type discrimination: 1. [Encoder and hash](rust-lang#159071) 2. [FnAbi, llvm.ptrauth.resign and Session API change](rust-lang#159074) 3. [FPTR_TYPE_DISCR in ABI Version](rust-lang#159075) 4. [Static allocs](rust-lang#159081) 5. [Transmutes](rust-lang#159082) 6. [Propagate discriminator logic through remaining get_fn_ptr calls sites](rust-lang#159084) 7. [Minicore updates to support fn ptr type discriminator tests](rust-lang#159086) 8. [Fn ptr type discrimination tests](rust-lang#159087) --- Useful links: * Previous PAC work: * `pauthtest` introduction: rust-lang#155722 * Library support follow up: rust-lang#156548 * Config follow up: rust-lang#156712 * [Project goal](https://rust-lang.github.io/rust-project-goals/2026/aarch64_pointer_authentication_pauthtest.html) and [tracking issue](rust-lang/goals#618) * Clang's implementation of [ASTContext::encodeTypeForFunctionPointerAuth](https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3) * LLVM's [SpiHash](https://github.com/llvm/llvm-project/blob/main/third-party/siphash/include/siphash/SipHash.h)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Aug 19, 2026
…=davidtwco [PAC] Encoder and hash (1/8) This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used for pointer authentication. Compatibility with Clang is a primary design goal. For a given extern "C" function type, the discriminator produced by Rust must match the value computed by Clang so that function pointers can be exchanged safely between Rust and C code while preserving pointer authentication semantics. The implementation mirrors Clang's behavior in ASTContext::encodeTypeForFunctionPointerAuth, ensuring that identical C-compatible function types produce identical discriminators. See: https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3. --- This is part 1 of a sequence of 8 PRs that together implement support for function pointer type discrimination: 1. [Encoder and hash](rust-lang#159071) 2. [FnAbi, llvm.ptrauth.resign and Session API change](rust-lang#159074) 3. [FPTR_TYPE_DISCR in ABI Version](rust-lang#159075) 4. [Static allocs](rust-lang#159081) 5. [Transmutes](rust-lang#159082) 6. [Propagate discriminator logic through remaining get_fn_ptr calls sites](rust-lang#159084) 7. [Minicore updates to support fn ptr type discriminator tests](rust-lang#159086) 8. [Fn ptr type discrimination tests](rust-lang#159087) --- Useful links: * Previous PAC work: * `pauthtest` introduction: rust-lang#155722 * Library support follow up: rust-lang#156548 * Config follow up: rust-lang#156712 * [Project goal](https://rust-lang.github.io/rust-project-goals/2026/aarch64_pointer_authentication_pauthtest.html) and [tracking issue](rust-lang/goals#618) * Clang's implementation of [ASTContext::encodeTypeForFunctionPointerAuth](https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3) * LLVM's [SpiHash](https://github.com/llvm/llvm-project/blob/main/third-party/siphash/include/siphash/SipHash.h)
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 19, 2026
…uwer Rollup of 16 pull requests Successful merges: - #159071 ([PAC] Encoder and hash (1/8)) - #161277 (bootstrap: Move all non-module items out of the crate root) - #161332 (Some `GlobalCtxt`/`Session` cleanups) - #161344 (Update the `rustc-perf` submodule) - #150931 (rustdoc: Always document `#[repr(transparent)]` if `#[rustc_pub_transparent]` is applied) - #160582 (Add `remove hidden_glob_reexports item breaks downstream` test) - #160876 (remove unwrap from write_mir_fn_graphviz) - #160927 (Enhance EII UI tests) - #161070 (fix arm homogeneous aggregate ABI) - #161236 (Download auto jobs in citool in parallel) - #161254 (Reserve capacity for 3% anon nodes) - #161283 (Tighten the language used for documenting `TargetOptions::llvm_abiname`) - #161291 (Rename `ProjectionPredicate` and `TraitPredicate`) - #161299 (Remove a bunch of unnecessary explicit lifetimes) - #161307 (make ARM maintainers pingable) - #161308 (Add regression test for rustc diagnostic to recognize variables in match guards)
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Aug 19, 2026
…=davidtwco [PAC] Encoder and hash (1/8) This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used for pointer authentication. Compatibility with Clang is a primary design goal. For a given extern "C" function type, the discriminator produced by Rust must match the value computed by Clang so that function pointers can be exchanged safely between Rust and C code while preserving pointer authentication semantics. The implementation mirrors Clang's behavior in ASTContext::encodeTypeForFunctionPointerAuth, ensuring that identical C-compatible function types produce identical discriminators. See: https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3. --- This is part 1 of a sequence of 8 PRs that together implement support for function pointer type discrimination: 1. [Encoder and hash](rust-lang#159071) 2. [FnAbi, llvm.ptrauth.resign and Session API change](rust-lang#159074) 3. [FPTR_TYPE_DISCR in ABI Version](rust-lang#159075) 4. [Static allocs](rust-lang#159081) 5. [Transmutes](rust-lang#159082) 6. [Propagate discriminator logic through remaining get_fn_ptr calls sites](rust-lang#159084) 7. [Minicore updates to support fn ptr type discriminator tests](rust-lang#159086) 8. [Fn ptr type discrimination tests](rust-lang#159087) --- Useful links: * Previous PAC work: * `pauthtest` introduction: rust-lang#155722 * Library support follow up: rust-lang#156548 * Config follow up: rust-lang#156712 * [Project goal](https://rust-lang.github.io/rust-project-goals/2026/aarch64_pointer_authentication_pauthtest.html) and [tracking issue](rust-lang/goals#618) * Clang's implementation of [ASTContext::encodeTypeForFunctionPointerAuth](https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3) * LLVM's [SpiHash](https://github.com/llvm/llvm-project/blob/main/third-party/siphash/include/siphash/SipHash.h)
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 19, 2026
…uwer Rollup of 16 pull requests Successful merges: - #159071 ([PAC] Encoder and hash (1/8)) - #161068 (Ensure TLS accesses don't call the global allocator through panic (part 3) ) - #161332 (Some `GlobalCtxt`/`Session` cleanups) - #161344 (Update the `rustc-perf` submodule) - #150931 (rustdoc: Always document `#[repr(transparent)]` if `#[rustc_pub_transparent]` is applied) - #160582 (Add `remove hidden_glob_reexports item breaks downstream` test) - #160876 (remove unwrap from write_mir_fn_graphviz) - #160927 (Enhance EII UI tests) - #161070 (fix arm homogeneous aggregate ABI) - #161236 (Download auto jobs in citool in parallel) - #161254 (Reserve capacity for 3% anon nodes) - #161283 (Tighten the language used for documenting `TargetOptions::llvm_abiname`) - #161291 (Rename `ProjectionPredicate` and `TraitPredicate`) - #161299 (Remove a bunch of unnecessary explicit lifetimes) - #161307 (make ARM maintainers pingable) - #161308 (Add regression test for rustc diagnostic to recognize variables in match guards)
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Aug 19, 2026
[PAC] Encoder and hash (1/8) This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used for pointer authentication. Compatibility with Clang is a primary design goal. For a given extern "C" function type, the discriminator produced by Rust must match the value computed by Clang so that function pointers can be exchanged safely between Rust and C code while preserving pointer authentication semantics. The implementation mirrors Clang's behavior in ASTContext::encodeTypeForFunctionPointerAuth, ensuring that identical C-compatible function types produce identical discriminators. See: https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3. --- This is part 1 of a sequence of 8 PRs that together implement support for function pointer type discrimination: 1. [Encoder and hash](#159071) 2. [FnAbi, llvm.ptrauth.resign and Session API change](#159074) 3. [FPTR_TYPE_DISCR in ABI Version](#159075) 4. [Static allocs](#159081) 5. [Transmutes](#159082) 6. [Propagate discriminator logic through remaining get_fn_ptr calls sites](#159084) 7. [Minicore updates to support fn ptr type discriminator tests](#159086) 8. [Fn ptr type discrimination tests](#159087) --- Useful links: * Previous PAC work: * `pauthtest` introduction: #155722 * Library support follow up: #156548 * Config follow up: #156712 * [Project goal](https://rust-lang.github.io/rust-project-goals/2026/aarch64_pointer_authentication_pauthtest.html) and [tracking issue](rust-lang/goals#618) * Clang's implementation of [ASTContext::encodeTypeForFunctionPointerAuth](https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3) * LLVM's [SpiHash](https://github.com/llvm/llvm-project/blob/main/third-party/siphash/include/siphash/SipHash.h)
Contributor
|
💔 Test for b088fd7 failed: CI. Failed job:
|
Member
|
@bors retry |
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Aug 19, 2026
…=davidtwco [PAC] Encoder and hash (1/8) This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used for pointer authentication. Compatibility with Clang is a primary design goal. For a given extern "C" function type, the discriminator produced by Rust must match the value computed by Clang so that function pointers can be exchanged safely between Rust and C code while preserving pointer authentication semantics. The implementation mirrors Clang's behavior in ASTContext::encodeTypeForFunctionPointerAuth, ensuring that identical C-compatible function types produce identical discriminators. See: https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3. --- This is part 1 of a sequence of 8 PRs that together implement support for function pointer type discrimination: 1. [Encoder and hash](rust-lang#159071) 2. [FnAbi, llvm.ptrauth.resign and Session API change](rust-lang#159074) 3. [FPTR_TYPE_DISCR in ABI Version](rust-lang#159075) 4. [Static allocs](rust-lang#159081) 5. [Transmutes](rust-lang#159082) 6. [Propagate discriminator logic through remaining get_fn_ptr calls sites](rust-lang#159084) 7. [Minicore updates to support fn ptr type discriminator tests](rust-lang#159086) 8. [Fn ptr type discrimination tests](rust-lang#159087) --- Useful links: * Previous PAC work: * `pauthtest` introduction: rust-lang#155722 * Library support follow up: rust-lang#156548 * Config follow up: rust-lang#156712 * [Project goal](https://rust-lang.github.io/rust-project-goals/2026/aarch64_pointer_authentication_pauthtest.html) and [tracking issue](rust-lang/goals#618) * Clang's implementation of [ASTContext::encodeTypeForFunctionPointerAuth](https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3) * LLVM's [SpiHash](https://github.com/llvm/llvm-project/blob/main/third-party/siphash/include/siphash/SipHash.h)
This file contains hidden or 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
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.
View all comments
This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used for pointer authentication. Compatibility with Clang is a primary design goal. For a given extern "C" function type, the discriminator produced by Rust must match the value computed by Clang so that function pointers can be exchanged safely between Rust and C code while preserving pointer authentication semantics.
The implementation mirrors Clang's behavior in ASTContext::encodeTypeForFunctionPointerAuth, ensuring that identical C-compatible function types produce identical discriminators. See: https://clang.llvm.org/doxygen/ASTContext_8cpp.html#abb1375e068e807917527842d05cadea3.
This is part 1 of a sequence of 8 PRs that together implement support for function pointer type discrimination:
Useful links:
pauthtestintroduction: Introduce aarch64-unknown-linux-pauthtest target #155722