[PAC] FPTR_TYPE_DISCR in ABI Version (3/8)#159075
Conversation
d746518 to
a098946
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
a098946 to
e1b80e7
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e1b80e7 to
7135bea
Compare
This comment has been minimized.
This comment has been minimized.
66aaf1e to
951b670
Compare
| | (u32::from(self.indirect_gotos) << GOTOS) | ||
| | (u32::from(self.typeinfo_vt_ptr_discrimination) << TYPEINFO_VT_PTR_DISCR); | ||
| | (u32::from(self.typeinfo_vt_ptr_discrimination) << TYPEINFO_VT_PTR_DISCR) | ||
| | (u32::from(self.function_pointers.as_ref().is_some_and(|schema| { |
There was a problem hiding this comment.
Would it be beneficial to add some assertion ensuring that if function_pointers is some, it's kind must be only PointerAuthDiscrimination::Type?
There was a problem hiding this comment.
That's not always true though,PointerAuthOption::Calls will result in default function pointer schema, which does not specify PointerAuthDiscrimination::Type (it uses: PointerAuthDiscrimination::None).
951b670 to
df46abe
Compare
This comment has been minimized.
This comment has been minimized.
df46abe to
8c3ef4c
Compare
This patch implements Rust's equivalent of Clang's function pointer type discriminator computation used in pointer authentication. Compatibility with Clang is a primary goal. The discriminator produced for a given external "C" function type 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 patch introduces the following: * Extends `FnAbi` (`callconv`) with a `ptrauth_type_discriminator` field. This field is only used when emitting pointer authentication call bundles. It is stored in `FnAbi` because the call site is not guaranteed to have access to an `Instance`, so the discriminator cannot always be computed on demand. * Adds support for `llvm.ptrauth.resign`. This intrinsic will be used when support for semantic transmute is added. * Performs a minor API redesign as groundwork for allowing call sites to modify schemas in place.
8c3ef4c to
af72799
Compare
Also remove error messages/tests that used to guarded it.
af72799 to
06c9628
Compare
|
Some changes occurred in src/doc/rustc/src/platform-support cc @Noratrieb
|
|
r? compiler |
|
rustbot has assigned @petrochenkov. Use Why was this reviewer chosen?The reviewer was selected based on:
|
followed immediately by:
which is weird. Anyway, I don't know the first thing about this stuff, so I'll try to find a better reviewer. |
This patch extends the ABI version to include
FPTR_TYPE_DISCR. It also removes the diagnostics and tests that previously guarded the unsupported function pointer type discrimination feature, since that functionality is now implemented.This is part 3 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