llvm-project/llvm/test/Instrumentation/MemorySanitizer
Alexander Potapenko 06d00afa61 MSan: handle llvm.lifetime.start intrinsic
Summary:
When a variable goes into scope several times within a single function
or when two variables from different scopes share a stack slot it may
be incorrect to poison such scoped locals at the beginning of the
function.
In the former case it may lead to false negatives (see
https://github.com/google/sanitizers/issues/590), in the latter - to
incorrect reports (because only one origin remains on the stack).

If Clang emits lifetime intrinsics for such scoped variables we insert
code poisoning them after each call to llvm.lifetime.start().
If for a certain intrinsic we fail to find a corresponding alloca, we
fall back to poisoning allocas for the whole function, as it's now
impossible to tell which alloca was missed.

The new instrumentation may slow down hot loops containing local
variables with lifetime intrinsics, so we allow disabling it with
-mllvm -msan-handle-lifetime-intrinsics=false.

Reviewers: eugenis, pcc

Subscribers: hiraditya, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60617

llvm-svn: 359536
2019-04-30 08:35:14 +00:00
..
AArch64 [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
Mips [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
PowerPC [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
X86 [NewPM][MSan] Add Options Handling 2019-02-04 21:02:49 +00:00
alloca.ll MSan: handle llvm.lifetime.start intrinsic 2019-04-30 08:35:14 +00:00
array_types.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
atomics.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
bmi.ll [msan] Instrument x86 BMI intrinsics. 2019-03-04 22:58:20 +00:00
byval-alignment.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
check-constant-shadow.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
check_access_address.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
csr.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
global_ctors_2to3.ll [MSan] Apply the ctor creation scheme of TSan 2019-01-16 11:14:07 +00:00
instrumentation-with-call-threshold.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
manual-shadow.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
masked-store-load.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
missing_origin.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
msan_asm_conservative.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
msan_basic.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
msan_kernel_basic.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
msan_llvm_is_constant.ll [MSan] Apply the ctor creation scheme of TSan 2019-01-16 11:14:07 +00:00
msan_x86_bts_asm.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
msan_x86intrinsics.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
mul_by_constant.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
nosanitize.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
origin-alignment.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
origin-array.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
pr32842.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
return_from_main.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
store-long-origin.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
store-origin.ll IR: Support parsing numeric block ids, and emit them in textual output. 2019-03-22 18:27:13 +00:00
str-nobuiltin.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
unreachable.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
unsized_type.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
vector_arith.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
vector_cmp.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
vector_cvt.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
vector_pack.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
vector_shift.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00
with-call-type-size.ll [NewPM] Port Msan 2019-01-03 13:42:44 +00:00