[PATCH] D99380: [llvm][hwasan] Add Fuchsia shadow mapping configuration
Leonard Chan via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 25 14:25:52 PDT 2021
leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr, pcc, eugenis.
leonardchan added a project: LLVM.
Herald added a subscriber: hiraditya.
leonardchan requested review of this revision.
Ensure that Fuchsia shadow memory starts at zero.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D99380
Files:
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
llvm/test/Instrumentation/HWAddressSanitizer/fuchsia.ll
Index: llvm/test/Instrumentation/HWAddressSanitizer/fuchsia.ll
===================================================================
--- /dev/null
+++ llvm/test/Instrumentation/HWAddressSanitizer/fuchsia.ll
@@ -0,0 +1,9 @@
+; Check HWASan shadow mapping on Fuchsia.
+; RUN: opt -hwasan -S -mtriple=aarch64-unknown-fuchsia < %s | FileCheck %s
+
+define i32 @test_load(i32* %a) sanitize_hwaddress {
+; CHECK: %.hwasan.shadow = call i8* asm "", "=r,0"(i8* null)
+entry:
+ %x = load i32, i32* %a, align 4
+ ret i32 %x
+}
Index: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1531,7 +1531,11 @@
void HWAddressSanitizer::ShadowMapping::init(Triple &TargetTriple,
bool InstrumentWithCalls) {
Scale = kDefaultShadowScale;
- if (ClMappingOffset.getNumOccurrences() > 0) {
+ if (TargetTriple.isOSFuchsia()) {
+ InGlobal = false;
+ InTls = false;
+ Offset = 0;
+ } else if (ClMappingOffset.getNumOccurrences() > 0) {
InGlobal = false;
InTls = false;
Offset = ClMappingOffset;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99380.333424.patch
Type: text/x-patch
Size: 1252 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210325/a67519b9/attachment.bin>
More information about the llvm-commits
mailing list