-
Notifications
You must be signed in to change notification settings - Fork 12k
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
[compiler-rt][ubsan][nfc-ish] Fix a type conversion bug #100665
Conversation
With llvm#100483, if the inline asm version of `ptrauth_strip` is used instead of the builtin, the inline asm implementation will return an unsigned long, causing an incompatible pointer conversion issue.
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Alan Zhao (alanzhao1) ChangesWith #100483, if the inline asm version of Full diff: https://github.com/llvm/llvm-project/pull/100665.diff 1 Files Affected:
diff --git a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
index 15788574dd995..7cc57268d40da 100644
--- a/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_type_hash_itanium.cpp
@@ -207,7 +207,8 @@ struct VtablePrefix {
std::type_info *TypeInfo;
};
VtablePrefix *getVtablePrefix(void *Vtable) {
- Vtable = ptrauth_strip(Vtable, ptrauth_key_cxx_vtable_pointer);
+ Vtable = reinterpret_cast<void *>(
+ ptrauth_strip(Vtable, ptrauth_key_cxx_vtable_pointer));
VtablePrefix *Vptr = reinterpret_cast<VtablePrefix*>(Vtable);
VtablePrefix *Prefix = Vptr - 1;
if (!IsAccessibleMemoryRange((uptr)Prefix, sizeof(VtablePrefix)))
|
To be more precise, it was inline asm version before that PR. It was just an implicit cast due to function call result. |
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.
Provided that downstream builds pass. AFAIK there are no public builtbots that checks pac-ret configuration.
Thanks!
Updated the PR description. |
@alanzhao1 Actually, the spec for
So, I think we'd also fix the inline asm version while here. How about the following:
? |
Done |
/cherry-pick 25f9415 |
Failed to cherry-pick: 25f9415 https://github.com/llvm/llvm-project/actions/runs/10103888499 Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request |
/cherry-pick 25f9415 |
If the inline asm version of `ptrauth_strip` is used instead of the builtin, the inline asm implementation currently returns an unsigned long, causing an incompatible pointer conversion issue. The spec for `ptrauth_sign` is that the result has the same type as the original value, so we add a cast to the result of the inline asm. (cherry picked from commit 25f9415)
/pull-request #100713 |
If the inline asm version of `ptrauth_strip` is used instead of the builtin, the inline asm implementation currently returns an unsigned long, causing an incompatible pointer conversion issue. The spec for `ptrauth_sign` is that the result has the same type as the original value, so we add a cast to the result of the inline asm. (cherry picked from commit 25f9415)
If the inline asm version of
ptrauth_strip
is used instead of the builtin, the inline asm implementation will return an unsigned long, causing an incompatible pointer conversion issue.