-
Notifications
You must be signed in to change notification settings - Fork 15.1k
Add deactivation symbol operand to ConstantPtrAuth. #133537
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: users/pcc/spr/main.add-deactivation-symbol-operand-to-constantptrauth
Are you sure you want to change the base?
Changes from 3 commits
e471928
90ec548
3190e38
150a83f
4042701
8413f5e
f4981a9
e728f34
063c7a4
cff37c4
60e836e
a780d18
51c353b
fae818f
f0afa10
1656b78
4890d9a
cb4704b
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 |
|---|---|---|
|
|
@@ -1603,7 +1603,13 @@ Expected<Value *> BitcodeReader::materializeValue(unsigned StartValID, | |
| if (!Disc) | ||
| return error("ptrauth disc operand must be ConstantInt"); | ||
|
|
||
| C = ConstantPtrAuth::get(ConstOps[0], Key, Disc, ConstOps[3]); | ||
| auto *DeactivationSymbol = | ||
| ConstOps.size() > 4 ? ConstOps[4] | ||
| : ConstantPointerNull::get(cast<PointerType>( | ||
| ConstOps[3]->getType())); | ||
|
|
||
| C = ConstantPtrAuth::get(ConstOps[0], Key, Disc, ConstOps[3], | ||
| DeactivationSymbol); | ||
| break; | ||
| } | ||
| case BitcodeConstant::NoCFIOpcode: { | ||
|
|
@@ -3801,6 +3807,16 @@ Error BitcodeReader::parseConstants() { | |
| (unsigned)Record[2], (unsigned)Record[3]}); | ||
| break; | ||
| } | ||
| case bitc::CST_CODE_PTRAUTH2: { | ||
| if (Record.size() < 4) | ||
|
||
| return error("Invalid ptrauth record"); | ||
| // Ptr, Key, Disc, AddrDisc, DeactivationSymbol | ||
| V = BitcodeConstant::create( | ||
| Alloc, CurTy, BitcodeConstant::ConstantPtrAuthOpcode, | ||
| {(unsigned)Record[0], (unsigned)Record[1], (unsigned)Record[2], | ||
| (unsigned)Record[3], (unsigned)Record[4]}); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| assert(V->getType() == getTypeByID(CurTyID) && "Incorrect result type ID"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1699,7 +1699,9 @@ LLVMValueRef LLVMConstantPtrAuth(LLVMValueRef Ptr, LLVMValueRef Key, | |
| LLVMValueRef Disc, LLVMValueRef AddrDisc) { | ||
| return wrap(ConstantPtrAuth::get( | ||
| unwrap<Constant>(Ptr), unwrap<ConstantInt>(Key), | ||
| unwrap<ConstantInt>(Disc), unwrap<Constant>(AddrDisc))); | ||
| unwrap<ConstantInt>(Disc), unwrap<Constant>(AddrDisc), | ||
| ConstantPointerNull::get( | ||
| cast<PointerType>(unwrap<Constant>(AddrDisc)->getType())))); | ||
|
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. Do we want to extend the C API to give access to this? 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 reckon that could be done in a followup if anyone needs it. |
||
| } | ||
|
|
||
| /*-- Opcode mapping */ | ||
|
|
||
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.
[nit] while there is a type named on the rhs, I think based on the ternary rather than single option, this should be
Constant *instead ofauto *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.
Done