[all-commits] [llvm/llvm-project] 20d6de: -fsanitize=function: fix alignment fault on Arm ta...
Simon Tatham via All-commits
all-commits at lists.llvm.org
Thu May 25 01:23:27 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 20d6dee40d507d467d3312d5e7dfdf088f106d31
https://github.com/llvm/llvm-project/commit/20d6dee40d507d467d3312d5e7dfdf088f106d31
Author: Simon Tatham <simon.tatham at arm.com>
Date: 2023-05-25 (Thu, 25 May 2023)
Changed paths:
M clang/lib/CodeGen/CGExpr.cpp
M clang/test/CodeGen/ubsan-function.cpp
Log Message:
-----------
-fsanitize=function: fix alignment fault on Arm targets.
Function pointers are checked by loading a prefix structure from just
before the function's entry point. However, on Arm, the function
pointer is not always exactly equal to the address of the entry point,
because Thumb function pointers have the low bit set to tell the BX
instruction to enter them in Thumb state. So the generated code loads
from an odd address and suffers an alignment fault.
Fixed by clearing the low bit of the function pointer before
subtracting 8.
Differential Revision: https://reviews.llvm.org/D151308
More information about the All-commits
mailing list