[compiler-rt] 25f9415 - [compiler-rt][ubsan][nfc-ish] Fix a type conversion bug (#100665)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 25 17:38:47 PDT 2024
Author: Alan Zhao
Date: 2024-07-25T17:38:44-07:00
New Revision: 25f9415713f9f57760a5322876906dc11385ef8e
URL: https://github.com/llvm/llvm-project/commit/25f9415713f9f57760a5322876906dc11385ef8e
DIFF: https://github.com/llvm/llvm-project/commit/25f9415713f9f57760a5322876906dc11385ef8e.diff
LOG: [compiler-rt][ubsan][nfc-ish] Fix a type conversion bug (#100665)
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.
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h b/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
index b5215c0d49c06..265a9925a15a0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
@@ -18,7 +18,7 @@
// the NOP space so will do nothing when it is not enabled or not available.
# define ptrauth_strip(__value, __key) \
({ \
- unsigned long ret; \
+ __typeof(__value) ret; \
asm volatile( \
"mov x30, %1\n\t" \
"hint #7\n\t" \
More information about the llvm-commits
mailing list