summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/SanitizerArgs.cpp
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2019-08-06 22:07:29 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2019-08-06 22:07:29 +0000
commit0930643ff6f1684bf234a97f6a3b76bf8e30b0a1 (patch)
treee3f16c6f74310e4b9d31df5b9d90ecc66f4ce394 /clang/lib/Driver/SanitizerArgs.cpp
parentb3292a8469c398214e88d2dd56be6f4edb1d1728 (diff)
downloadbcm5719-llvm-0930643ff6f1684bf234a97f6a3b76bf8e30b0a1.tar.gz
bcm5719-llvm-0930643ff6f1684bf234a97f6a3b76bf8e30b0a1.zip
hwasan: Instrument globals.
Globals are instrumented by adding a pointer tag to their symbol values and emitting metadata into a special section that allows the runtime to tag their memory when the library is loaded. Due to order of initialization issues explained in more detail in the comments, shadow initialization cannot happen during regular global initialization. Instead, the location of the global section is marked using an ELF note, and we require libc support for calling a function provided by the HWASAN runtime when libraries are loaded and unloaded. Based on ideas discussed with @evgeny777 in D56672. Differential Revision: https://reviews.llvm.org/D65770 llvm-svn: 368102
Diffstat (limited to 'clang/lib/Driver/SanitizerArgs.cpp')
-rw-r--r--clang/lib/Driver/SanitizerArgs.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Driver/SanitizerArgs.cpp b/clang/lib/Driver/SanitizerArgs.cpp
index 814e95200d9..8e59e19be35 100644
--- a/clang/lib/Driver/SanitizerArgs.cpp
+++ b/clang/lib/Driver/SanitizerArgs.cpp
@@ -1013,6 +1013,11 @@ void SanitizerArgs::addArgs(const ToolChain &TC, const llvm::opt::ArgList &Args,
CmdArgs.push_back(Args.MakeArgString("hwasan-abi=" + HwasanAbi));
}
+ if (Sanitizers.has(SanitizerKind::HWAddress)) {
+ CmdArgs.push_back("-target-feature");
+ CmdArgs.push_back("+tagged-globals");
+ }
+
// MSan: Workaround for PR16386.
// ASan: This is mainly to help LSan with cases such as
// https://github.com/google/sanitizers/issues/373
OpenPOWER on IntegriCloud