Skip to content

Commit

Permalink
[compiler-rt][ubsan][nfc-ish] Fix a type conversion bug (llvm#100665)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
alanzhao1 authored Jul 26, 2024
1 parent 8644a2a commit 25f9415
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler-rt/lib/sanitizer_common/sanitizer_ptrauth.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down

0 comments on commit 25f9415

Please sign in to comment.