-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[CodeGen][AArch64] ptrauth intrinsic to safely construct relative ptr #142047
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
Open
AbhayKanhere
wants to merge
4
commits into
llvm:main
Choose a base branch
from
AbhayKanhere:dev/abhay/ptrauth_intrinsic_for_relative_ptr_swift_coroutine_support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0ab5d47
[CodeGen][AArch64] ptrauth intrinsic to safely construct relative poi…
AbhayKanhere b57dd79
renamed addend to offset, other nits
AbhayKanhere f748d51
Updated glue/chain for intrinsic and a test.
AbhayKanhere 9113a48
Merge branch 'main' into dev/abhay/ptrauth_intrinsic_for_relative_ptr…
AbhayKanhere 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -178,6 +178,31 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t; | |
| __builtin_ptrauth_auth_and_resign(__value, __old_key, __old_data, __new_key, \ | ||
| __new_data) | ||
|
|
||
| /* Authenticate a pointer using one scheme, load 32bit value at offset addend | ||
| from the pointer, and add this value to the pointer, sign using specified | ||
| scheme. | ||
|
|
||
| If the result is subsequently authenticated using the new scheme, that | ||
| authentication is guaranteed to fail if and only if the initial | ||
| authentication failed. | ||
|
|
||
| The value must be an expression of pointer type. | ||
| The key must be a constant expression of type ptrauth_key. | ||
| The extra data must be an expression of pointer or integer type; | ||
| if an integer, it will be coerced to ptrauth_extra_data_t. | ||
| The addend must be an immediate ptrdiff_t value. | ||
| The result will have the same type as the original value. | ||
|
|
||
| This operation is guaranteed to not leave the intermediate value | ||
| available for attack before it is re-signed. | ||
|
|
||
| Do not pass a null pointer to this function. A null pointer | ||
| will not successfully authenticate. */ | ||
| #define ptrauth_auth_load_relative_and_sign(__value, __old_key, __old_data, \ | ||
AbhayKanhere marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| __new_key, __new_data, __addend) \ | ||
| __builtin_ptrauth_auth_load_relative_and_sign( \ | ||
| __value, __old_key, __old_data, __new_key, __new_data, __addend) | ||
|
|
||
| /* Authenticate a pointer using one scheme and resign it as a C | ||
| function pointer. | ||
|
|
||
|
|
@@ -351,6 +376,17 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t; | |
| __value; \ | ||
| }) | ||
|
|
||
| #define ptrauth_auth_load_relative_and_sign(__value, __old_key, __old_data, \ | ||
| __new_key, __new_data, __addend) \ | ||
| ({ \ | ||
| (void)__old_key; \ | ||
| (void)__old_data; \ | ||
| (void)__new_key; \ | ||
| (void)__new_data; \ | ||
| const char *__value_tmp = (const char *)(__value); \ | ||
| (void *)(__value_tmp + *(const int *)(__value_tmp + (__addend))); \ | ||
| }) | ||
|
|
||
| #define ptrauth_auth_function(__value, __old_key, __old_data) \ | ||
| ({ \ | ||
| (void)__old_key; \ | ||
|
|
@@ -380,7 +416,6 @@ typedef __UINTPTR_TYPE__ ptrauth_generic_signature_t; | |
| ((ptrauth_generic_signature_t)0); \ | ||
| }) | ||
|
|
||
|
|
||
|
Contributor
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. nit: revert :D |
||
| #define ptrauth_cxx_vtable_pointer(key, address_discrimination, \ | ||
| extra_discrimination...) | ||
|
|
||
AbhayKanhere marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.