[PATCH] D148573: Port -fsanitize=function to AArch64
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 17 14:36:20 PDT 2023
MaskRay created this revision.
MaskRay added reviewers: dmgreen, lenary, pcc, peter.smith.
Herald added subscribers: Enna1, hiraditya, kristof.beyls, emaste.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added projects: clang, Sanitizers, LLVM.
Herald added subscribers: llvm-commits, Sanitizers, cfe-commits.
-fsanitize=function instrumented functions have two words preceding at the
function label: a signature and an indirect RTTI object.
The signature also serves as a branch instruction skipping the two words.
With this patch, clang -fsanitize=function correctly instrument aarch64
and aarch64_be target triples.
_Z3funv:
.word 335544322 // signature
.word .L__llvm_rtti_proxy-_Z3funv // indirect RTTI
_Z6callerPFvvE:
if the first word loaded from the function pointer is not 335544322, skip
load the second word and dereference the indirect RTTI object, if not the expected typeinfo object, fail
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148573
Files:
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/Driver/ToolChains/FreeBSD.cpp
clang/lib/Driver/ToolChains/Linux.cpp
clang/test/CodeGen/ubsan-function.cpp
clang/test/Driver/fsanitize.c
compiler-rt/test/ubsan/TestCases/TypeCheck/Function/lit.local.cfg.py
llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/test/CodeGen/AArch64/func-sanitizer.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148573.514414.patch
Type: text/x-patch
Size: 6463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230417/f2fc4a01/attachment-0001.bin>
More information about the cfe-commits
mailing list