-
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 1 commit
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,18 @@ 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: As ip here is not signed (raw, non-PAC-enabled pointer) we | ||
| // must not use uw::_Unwind_FindEnclosingFunction. This is because, | ||
| // for pauthtest toolchain, libunwind will try to authenticate and | ||
| // resign it. Signing here (apart from risking creating a signing | ||
| // oracle) is not possible. According to the schema the value must | ||
| // be signed using SP as the discriminator - which is the problem. | ||
| // SP obtained here would not match the SP at the auth-resign time, | ||
| // as uw::_Unwind_FindEnclosingFunction creates a new context so | ||
| // the SP used for signing here would belong to a different frame | ||
| // that the one used for auth-resign. Hence return a 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.