-
Notifications
You must be signed in to change notification settings - Fork 284
Add support for aarch64-unknown-linux-pauthtest
#755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,6 +79,22 @@ impl Frame { | |
| // clause, and if this is fixed that test in theory can be run on macOS! | ||
| if cfg!(target_vendor = "apple") { | ||
| self.ip() | ||
| } else if cfg!(target_env = "pauthtest") { | ||
| // NOTE: ip here is an unsigned (raw) pointer, so we must not use | ||
| // uw::_Unwind_FindEnclosingFunction. | ||
| // | ||
| // Otherwise, in the pointer-authentication-enabled reference | ||
| // toolchain, libunwind would attempt to authenticate and re-sign | ||
| // values. Performing signing here is not safe: it could create a | ||
| // signing oracle, and more importantly it is incorrect under the | ||
| // expected signing schema. | ||
| // The schema requires the stack pointer (SP) as the discriminator. | ||
| // However, the SP available at this point would not match the SP | ||
| // at authentication/re-sign time, since | ||
| // _Unwind_FindEnclosingFunction constructs a new unwind context. | ||
| // The SP used here would therefore correspond to a different frame. | ||
| // As a result, we must return the raw value. | ||
| self.ip() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
A raw
This is the crux of the issue.
This cannot be fixed on the Rust side.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds like a bug in libunwind to me. What purpose does
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure, the documentation seems to be pretty scarce, and one I found is rather quite lax about possible outcomes of the call, explicitly allowing failure. I personally don't read it as a bug. To me it is more that
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me re-phrase the problem here.
It does not, perhaps this was an oversimplification on my side. The real problem is about what invariant You are right that On PAC aware platforms this will go through an auth/resign sequence: What that code does is it enforces that However, as you noted: So the issue isn’t just "signed vs unsigned". It’s that As a side note a notion of lack of support for |
||
| } else { | ||
| unsafe { uw::_Unwind_FindEnclosingFunction(self.ip()) } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this not check for the respective target feature being enabled? Not every target with pointer authentication enabled will use that target env, right?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right.
We're in the middle of preparing an upstream patch that introduces a pointer authentication aware target. It just so happens that in there I ended up using (incorrectly) the target environment as the gating mechanism.
We have a follow up task to resolve the target to a set of features, just like it's done in clang where it solves platform/environment specifics on the driver level and later on everything is based on language flags that are there regardless of the platform. And finally are resolved to a concrete signing schema.
This will become a bit more clear once the PR lands and I submit a ticket.