forked from OSchip/llvm-project
[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. llvm-svn: 228444
This commit is contained in:
parent
be9c91173f
commit
4e12057760
|
@ -702,7 +702,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
|
|||
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue