diff options
| author | Vitaly Buka <vitalybuka@google.com> | 2016-06-09 23:31:59 +0000 |
|---|---|---|
| committer | Vitaly Buka <vitalybuka@google.com> | 2016-06-09 23:31:59 +0000 |
| commit | b451f1bdf65d3bcd9fe60b21d26b003b18bf4601 (patch) | |
| tree | 1d76620b934b7ed123788ad49e2ff07dcf74ef22 /llvm/test | |
| parent | 8023233afd87cacd7fe9ae80df78bd797ef47250 (diff) | |
| download | bcm5719-llvm-b451f1bdf65d3bcd9fe60b21d26b003b18bf4601.tar.gz bcm5719-llvm-b451f1bdf65d3bcd9fe60b21d26b003b18bf4601.zip | |
Make sure that not interesting allocas are not instrumented.
Summary:
We failed to unpoison uninteresting allocas on return as unpoisoning is part of
main instrumentation which skips such allocas.
Added check -asan-instrument-allocas for dynamic allocas. If instrumentation of
dynamic allocas is disabled it will not will not be unpoisoned.
PR27453
Reviewers: kcc, eugenis
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21207
llvm-svn: 272341
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/Instrumentation/AddressSanitizer/lifetime.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll b/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll index dc43bc68fda..fb43e882705 100644 --- a/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll +++ b/llvm/test/Instrumentation/AddressSanitizer/lifetime.ll @@ -1,5 +1,6 @@ ; Test hanlding of llvm.lifetime intrinsics. ; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -S | FileCheck %s +; RUN: opt < %s -asan -asan-module -asan-use-after-scope -asan-use-after-return=0 -asan-instrument-allocas=0 -S | FileCheck %s --check-prefix=CHECK-NO-DYNAMIC 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" @@ -47,8 +48,10 @@ define void @lifetime() sanitize_address { call void @llvm.lifetime.start(i64 40, i8* %arr.ptr) store volatile i8 0, i8* %arr.ptr ; CHECK: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) + ; CHECK-NO-DYNAMIC-NOT: call void @__asan_unpoison_stack_memory(i64 %{{[^ ]+}}, i64 40) call void @llvm.lifetime.end(i64 40, i8* %arr.ptr) ; CHECK: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) + ; CHECK-NO-DYNAMIC-NOT: call void @__asan_poison_stack_memory(i64 %{{[^ ]+}}, i64 40) ; One more lifetime start/end for the same variable %i. call void @llvm.lifetime.start(i64 4, i8* %i.ptr) @@ -87,3 +90,20 @@ bb1: ; CHECK: ret void ret void } + +define void @zero_sized(i64 %a) #0 { +; CHECK-LABEL: define void @zero_sized(i64 %a) + +entry: + %a.addr = alloca i64, align 8 + %b = alloca [0 x i8], align 1 + store i64 %a, i64* %a.addr, align 8 + %0 = bitcast [0 x i8]* %b to i8* + call void @llvm.lifetime.start(i64 0, i8* %0) #2 + ; CHECK-NOT: call void @__asan_unpoison_stack_memory + %1 = bitcast [0 x i8]* %b to i8* + call void @llvm.lifetime.end(i64 0, i8* %1) #2 + ; CHECK-NOT: call void @__asan_poison_stack_memory + + ret void +} |

