[llvm] r228444 - [msan] Fix "missing origin" in atomic store.
Evgeniy Stepanov
eugeni.stepanov at gmail.com
Fri Feb 6 13:47:39 PST 2015
Author: eugenis
Date: Fri Feb 6 15:47:39 2015
New Revision: 228444
URL: http://llvm.org/viewvc/llvm-project?rev=228444&view=rev
Log:
[msan] Fix "missing origin" in atomic store.
An atomic store always make the target location fully initialized (in the
current implementation). It should not store origin. Initialized memory can't
have meaningful origin, and, due to origin granularity (4 bytes) there is a
chance that this extra store would overwrite meaningfull origin for an adjacent
location.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
llvm/trunk/test/Instrumentation/MemorySanitizer/atomics.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp?rev=228444&r1=228443&r2=228444&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/MemorySanitizer.cpp Fri Feb 6 15:47:39 2015
@@ -702,7 +702,7 @@ struct MemorySanitizerVisitor : public I
if (SI.isAtomic()) SI.setOrdering(addReleaseOrdering(SI.getOrdering()));
- if (MS.TrackOrigins)
+ if (MS.TrackOrigins && !SI.isAtomic())
storeOrigin(IRB, Addr, Shadow, getOrigin(Val), SI.getAlignment(),
InstrumentWithCalls);
}
Modified: llvm/trunk/test/Instrumentation/MemorySanitizer/atomics.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/MemorySanitizer/atomics.ll?rev=228444&r1=228443&r2=228444&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/MemorySanitizer/atomics.ll (original)
+++ llvm/trunk/test/Instrumentation/MemorySanitizer/atomics.ll Fri Feb 6 15:47:39 2015
@@ -1,4 +1,6 @@
; RUN: opt < %s -msan -msan-check-access-address=0 -S | FileCheck %s
+; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=1 -S | FileCheck %s
+; RUN: opt < %s -msan -msan-check-access-address=0 -msan-track-origins=2 -S | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
More information about the llvm-commits
mailing list