[PATCH] D158614: [UBSan] Disable the function sanitizer on an execute-only target.
Ying Yi via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 23 06:49:33 PDT 2023
MaggieYi created this revision.
MaggieYi added reviewers: MaskRay, peter.smith, vitalybuka, probinson, pgousseau, glandium, uabelho.
Herald added a project: All.
MaggieYi requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
PR for https://github.com/llvm/llvm-project/issues/64931.
An execute-only target disallows data access to code sections. When enabling the function sanitizer (-fsanitize=function), UBSan function signatures and type hashes are emitted within the function's prologue data to enable checking of the function type. This results in a non-execute access to the code section and a runtime error.
To solve the issue, -fsanitize=function should not be included in any check group (e.g. undefined) on an execute-only target. If a user passes -fsanitize=undefined, there is no error and no warning. However, if the user explicitly passes -fsanitize=function on an execute-only target, an error will be emitted.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D158614
Files:
clang/include/clang/Basic/DiagnosticCommonKinds.td
clang/include/clang/Basic/Sanitizers.h
clang/lib/Basic/CMakeLists.txt
clang/lib/Basic/Sanitizers.cpp
clang/lib/Driver/SanitizerArgs.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/ubsan-function.c
clang/test/CodeGenObjCXX/crash-function-type.mm
clang/test/Driver/fsanitize.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158614.552694.patch
Type: text/x-patch
Size: 9929 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230823/cfcaaabe/attachment.bin>
More information about the cfe-commits
mailing list