-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang] Define ptrauth_sign_constant builtin. #93904
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
Merged
ahmedbougacha
merged 6 commits into
main
from
users/ahmedbougacha/ptrauth-sign-constant
Jun 20, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2767407
[clang] Define ptrauth_sign_constant builtin.
ahmedbougacha 2cdd61a
Document ptrauth_sign_constant in clang/docs/PointerAuthentication.
ahmedbougacha f8b9fe4
Address feedback.
ahmedbougacha 7c4aab3
Simplify some functionality and address review feedback.
ahmedbougacha 3a08530
Add more codegen tests.
ahmedbougacha 68d0bb2
Remove leftover comment.
ahmedbougacha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
//===--- CGPointerAuth.cpp - IR generation for pointer authentication -----===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file contains common routines relating to the emission of | ||
// pointer authentication operations. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "CodeGenModule.h" | ||
#include "clang/CodeGen/CodeGenABITypes.h" | ||
|
||
using namespace clang; | ||
using namespace CodeGen; | ||
|
||
llvm::Constant * | ||
CodeGenModule::getConstantSignedPointer(llvm::Constant *Pointer, unsigned Key, | ||
llvm::Constant *StorageAddress, | ||
llvm::ConstantInt *OtherDiscriminator) { | ||
llvm::Constant *AddressDiscriminator; | ||
if (StorageAddress) { | ||
assert(StorageAddress->getType() == UnqualPtrTy); | ||
AddressDiscriminator = StorageAddress; | ||
} else { | ||
AddressDiscriminator = llvm::Constant::getNullValue(UnqualPtrTy); | ||
} | ||
|
||
llvm::ConstantInt *IntegerDiscriminator; | ||
if (OtherDiscriminator) { | ||
assert(OtherDiscriminator->getType() == Int64Ty); | ||
IntegerDiscriminator = OtherDiscriminator; | ||
} else { | ||
IntegerDiscriminator = llvm::ConstantInt::get(Int64Ty, 0); | ||
} | ||
|
||
return llvm::ConstantPtrAuth::get(Pointer, | ||
llvm::ConstantInt::get(Int32Ty, Key), | ||
IntegerDiscriminator, AddressDiscriminator); | ||
} |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
It would be nice to have this term described more deeply. Do you mean an absence of a signing oracle when talking about a non-attackable sequence?
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.
Later additions to this document describe that in depth, you can look for
on my branch
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.
Thanks, now I see that. I suppose we can leave the docs "as is" for this PR and submit missing parts as separate PRs later.