-
Notifications
You must be signed in to change notification settings - Fork 10.5k
LLVM-Passes: add pointer authentication to Swift's function merge pass. #34033
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
Conversation
@swift-ci test |
Build failed |
Build failed |
@@ -316,6 +325,15 @@ class SwiftMergeFunctions : public ModulePass { | |||
CurrentInst = &*std::next(CurrentInst->getIterator()); | |||
} | |||
|
|||
/// Returns true if the operand \p OpIdx of the current instruction is the | |||
/// callee of a call, which needs to be signed if passed as a parameter. |
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.
Oh, you might have a similar problem with the ptrauth intrinsics — you shouldn't turn a constant operand of llvm.ptrauth.sign
(which we have to do when e.g. storing into an address-diversified location) into a non-constant one. You'll need to turn the sign
into a resign
.
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.
Intrinsics are excluded from being parameterized, anyway.
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.
Okay, if the parameterization only happens with function calls and not other uses of functions, then yeah, this isn't a problem.
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.
Oh, I see, parameterization also doesn't consider uses by intrinsics.
@@ -337,12 +355,25 @@ class SwiftMergeFunctions : public ModulePass { | |||
/// All uses of the parameter in the merged function. | |||
SmallVector<OpLocation, 16> Uses; | |||
|
|||
/// The discriminator for pointer signing. | |||
/// Only not null, if needsPointerSigning is true. |
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.
Extra comma
// Replace all differing operands, which need pointer signing, with a | ||
// parameter. | ||
// We need to do that after all other parameters, because here we replace | ||
// call instructions, which must be life in case it has another constant to |
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.
"live"
If during merging a function pointer is passed as a parameter to the merged function, it needs to be signed on arm64e. rdar://problem/66797689
554a4c3
to
e4e5484
Compare
@swift-ci test |
1 similar comment
@swift-ci test |
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.
LGTM
If during merging a function pointer is passed as a parameter to the merged function, it needs to be signed on arm64e.
rdar://problem/66797689