llvm.org GIT mirror llvm / 6ce4a9f
[msan] Fix bad interaction between with-calls mode and chained origin tracking. Origin history should only be recorded for uninitialized values, because it is meaningless otherwise. This change moves __msan_chain_origin to the runtime library side and makes it conditional on the corresponding shadow value. Previous code was correct, but _very_ inefficient. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211700 91177308-0d34-0410-b5e6-96231b3b80d8 Evgeniy Stepanov 5 years ago
2 changed file(s) with 7 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
568568 ConvertedShadow, IRB.getIntNTy(8 * (1 << SizeIndex)));
569569 IRB.CreateCall3(Fn, ConvertedShadow2,
570570 IRB.CreatePointerCast(Addr, IRB.getInt8PtrTy()),
571 updateOrigin(Origin, IRB));
571 Origin);
572572 } else {
573573 Value *Cmp = IRB.CreateICmpNE(
574574 ConvertedShadow, getCleanShadow(ConvertedShadow), "_mscmp");
0 ; Test -msan-instrumentation-with-call-threshold
1 ; Test that in with-calls mode there are no calls to __msan_chain_origin - they
2 ; are done from __msan_maybe_store_origin_*.
13
24 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -S | FileCheck %s
35 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=1 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
6 ; RUN: opt < %s -msan -msan-check-access-address=0 -msan-instrumentation-with-call-threshold=0 -msan-track-origins=2 -S | FileCheck -check-prefix=CHECK -check-prefix=CHECK-ORIGINS %s
47
58 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"
69 target triple = "x86_64-unknown-linux-gnu"
4043 ; CHECK: load {{.*}} @__msan_param_tls
4144 ; CHECK-ORIGINS: load {{.*}} @__msan_param_origin_tls
4245 ; CHECK: store
46 ; CHECK-ORIGINS-NOT: __msan_chain_origin
4347 ; CHECK-ORIGINS: bitcast i64* {{.*}} to i8*
48 ; CHECK-ORIGINS-NOT: __msan_chain_origin
4449 ; CHECK-ORIGINS: call void @__msan_maybe_store_origin_8(
50 ; CHECK-ORIGINS-NOT: __msan_chain_origin
4551 ; CHECK: store i64
4652 ; CHECK: ret void