Strip sa_handler if ptrauth_calls is present#7
Open
jchlanda wants to merge 1 commit intoaccess-softek:v1.2.5-pauth-rev2025-11-21from
Open
Strip sa_handler if ptrauth_calls is present#7jchlanda wants to merge 1 commit intoaccess-softek:v1.2.5-pauth-rev2025-11-21from
jchlanda wants to merge 1 commit intoaccess-softek:v1.2.5-pauth-rev2025-11-21from
Conversation
This follows the same logic as for the restorer. Without stripping kernel would receive a signed address and use it, as is, to call the signal handler, which would result in an invalid memory access. For the record, this was spotted when running Rust signal handler as registered here (`fn init()`): https://github.com/rust-lang/rust/blob/main/library/std/src/sys/pal/unix/stack_overflow.rs#L184 Sample strace output showing invalid (signed) pointer: ``` rt_sigaction(SIGSEGV, {sa_handler=0x13f96bba92acf8, sa_mask=[], sa_flags=SA_RESTORER|SA_ONSTACK|SA_SIGINFO, sa_restorer=0xf96bbaad0430}, NULL, 8) = 0 ```
|
Thanks! Let me ensure that llvm-test-suite and pauth-testsuite continue passing with this patch applied before giving the final approval |
asl
reviewed
Mar 13, 2026
| } | ||
| ksa.handler = sa->sa_handler; | ||
| #if __has_feature(ptrauth_calls) | ||
| ksa.handler = __builtin_ptrauth_strip(ksa.handler, 0); |
There was a problem hiding this comment.
Don't we want to authenticate the pointer value instead of merely striping here and in similar places? @kovdan01
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.
Strip sa_handler if ptrauth_calls is present
This follows the same logic as for the restorer. Without stripping
kernel would receive a signed address and use it, as is, to call the
signal handler, which would result in an invalid memory access.
For the record, this was spotted when running Rust signal handler as
registered here (
fn init()):https://github.com/rust-lang/rust/blob/main/library/std/src/sys/pal/unix/stack_overflow.rs#L184
Sample strace output showing invalid (signed) pointer: