[llvm] r318493 - [asan] Test ASan instrumentation for shadow scale value of 5
Walter Lee via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 17:15:31 PST 2017
Author: waltl
Date: Thu Nov 16 17:15:31 2017
New Revision: 318493
URL: http://llvm.org/viewvc/llvm-project?rev=318493&view=rev
Log:
[asan] Test ASan instrumentation for shadow scale value of 5
Add additional RUN clauses to test for -asan-mapping-scale=5 in
selective tests, with special CHECK statements where needed.
Differential Revision: https://reviews.llvm.org/D39775
Modified:
llvm/trunk/test/Instrumentation/AddressSanitizer/adaptive_global_redzones.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/basic.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_array.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/instrument-stack.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_global.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll
llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/adaptive_global_redzones.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/adaptive_global_redzones.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/adaptive_global_redzones.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/adaptive_global_redzones.ll Thu Nov 16 17:15:31 2017
@@ -1,4 +1,5 @@
; RUN: opt < %s -asan -asan-module -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-mapping-scale=5 -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"
target triple = "x86_64-unknown-linux-gnu"
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/basic.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/basic.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/basic.ll Thu Nov 16 17:15:31 2017
@@ -1,6 +1,7 @@
; Test basic address sanitizer instrumentation.
;
-; RUN: opt < %s -asan -asan-module -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
+; RUN: opt < %s -asan -asan-module -asan-mapping-scale=5 -S | FileCheck --check-prefixes=CHECK,CHECK-S5 %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"
target triple = "x86_64-unknown-linux-gnu"
@@ -10,7 +11,8 @@ define i32 @test_load(i32* %a) sanitize_
; CHECK-LABEL: @test_load
; CHECK-NOT: load
; CHECK: %[[LOAD_ADDR:[^ ]*]] = ptrtoint i32* %a to i64
-; CHECK: lshr i64 %[[LOAD_ADDR]], 3
+; CHECK-S3: lshr i64 %[[LOAD_ADDR]], 3
+; CHECK-S5: lshr i64 %[[LOAD_ADDR]], 5
; CHECK: {{or|add}}
; CHECK: %[[LOAD_SHADOW_PTR:[^ ]*]] = inttoptr
; CHECK: %[[LOAD_SHADOW:[^ ]*]] = load i8, i8* %[[LOAD_SHADOW_PTR]]
@@ -18,7 +20,8 @@ define i32 @test_load(i32* %a) sanitize_
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}!prof ![[PROF:[0-9]+]]
;
; First instrumentation block refines the shadow test.
-; CHECK: and i64 %[[LOAD_ADDR]], 7
+; CHECK-S3: and i64 %[[LOAD_ADDR]], 7
+; CHECK-S5: and i64 %[[LOAD_ADDR]], 31
; CHECK: add i64 %{{.*}}, 3
; CHECK: trunc i64 %{{.*}} to i8
; CHECK: icmp sge i8 %{{.*}}, %[[LOAD_SHADOW]]
@@ -43,7 +46,8 @@ define void @test_store(i32* %a) sanitiz
; CHECK-LABEL: @test_store
; CHECK-NOT: store
; CHECK: %[[STORE_ADDR:[^ ]*]] = ptrtoint i32* %a to i64
-; CHECK: lshr i64 %[[STORE_ADDR]], 3
+; CHECK-S3: lshr i64 %[[STORE_ADDR]], 3
+; CHECK-S5: lshr i64 %[[STORE_ADDR]], 5
; CHECK: {{or|add}}
; CHECK: %[[STORE_SHADOW_PTR:[^ ]*]] = inttoptr
; CHECK: %[[STORE_SHADOW:[^ ]*]] = load i8, i8* %[[STORE_SHADOW_PTR]]
@@ -51,7 +55,8 @@ define void @test_store(i32* %a) sanitiz
; CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
;
; First instrumentation block refines the shadow test.
-; CHECK: and i64 %[[STORE_ADDR]], 7
+; CHECK-S3: and i64 %[[STORE_ADDR]], 7
+; CHECK-S5: and i64 %[[STORE_ADDR]], 31
; CHECK: add i64 %{{.*}}, 3
; CHECK: trunc i64 %{{.*}} to i8
; CHECK: icmp sge i8 %{{.*}}, %[[STORE_SHADOW]]
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata.ll Thu Nov 16 17:15:31 2017
@@ -1,4 +1,5 @@
; RUN: opt < %s -asan -asan-module -asan-globals-live-support=1 -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support=1 -asan-mapping-scale=5 -S | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_array.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_array.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_array.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/global_metadata_array.ll Thu Nov 16 17:15:31 2017
@@ -1,6 +1,7 @@
-; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck %s
-; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck %s
-; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -mtriple=x86_64-pc-windows-msvc19.0.24215 -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -mtriple=x86_64-apple-macosx10.11.0 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -mtriple=x86_64-pc-windows-msvc19.0.24215 -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support=0 -asan-mapping-scale=5 -mtriple=x86_64-unknown-linux-gnu -S | FileCheck --check-prefixes=CHECK,CHECK-S5 %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/instrument-stack.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/instrument-stack.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/instrument-stack.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/instrument-stack.ll Thu Nov 16 17:15:31 2017
@@ -1,5 +1,6 @@
; This test checks that we are not instrumenting direct inbound stack accesses.
; RUN: opt < %s -asan -asan-module -asan-opt-stack -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-opt-stack -asan-mapping-scale=5 -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"
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_global.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_global.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_global.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_global.ll Thu Nov 16 17:15:31 2017
@@ -1,4 +1,5 @@
; RUN: opt < %s -asan -asan-module -asan-globals-live-support=1 -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-globals-live-support=1 -asan-mapping-scale=5 -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"
target triple = "x86_64-unknown-linux-gnu"
@xxx = global i32 0, align 4
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/instrument_initializer_metadata.ll Thu Nov 16 17:15:31 2017
@@ -1,4 +1,5 @@
; RUN: opt < %s -asan -asan-module -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-mapping-scale=5 -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"
target triple = "x86_64-unknown-linux-gnu"
@xxx = internal global i32 0, align 4 ; With dynamic initializer.
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-byval-args.ll Thu Nov 16 17:15:31 2017
@@ -1,6 +1,8 @@
; This check verifies that arguments passed by value get redzones.
; RUN: opt < %s -asan -asan-realign-stack=32 -S | FileCheck %s
; RUN: opt < %s -asan -asan-realign-stack=32 -asan-force-dynamic-shadow -S | FileCheck %s
+; RUN: opt < %s -asan -asan-realign-stack=32 -asan-mapping-scale=5 -S | FileCheck %s
+; RUN: opt < %s -asan -asan-realign-stack=32 -asan-force-dynamic-shadow -asan-mapping-scale=5 -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"
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/stack_dynamic_alloca.ll Thu Nov 16 17:15:31 2017
@@ -1,5 +1,7 @@
; RUN: opt < %s -asan -asan-module -asan-stack-dynamic-alloca \
; RUN: -asan-use-after-return -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -asan-stack-dynamic-alloca -asan-mapping-scale=5 \
+; RUN: -asan-use-after-return -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"
Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll?rev=318493&r1=318492&r2=318493&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/test64.ll Thu Nov 16 17:15:31 2017
@@ -1,4 +1,5 @@
-; RUN: opt < %s -asan -asan-module -S | FileCheck %s
+; RUN: opt < %s -asan -asan-module -S | FileCheck --check-prefixes=CHECK,CHECK-S3 %s
+; RUN: opt < %s -asan -asan-module -asan-mapping-scale=5 -S | FileCheck --check-prefixes=CHECK,CHECK-S5 %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"
target triple = "x86_64-unknown-linux-gnu"
define i32 @read_4_bytes(i32* %a) sanitize_address {
@@ -8,9 +9,11 @@ entry:
}
; CHECK-LABEL: @read_4_bytes
; CHECK-NOT: ret
-; CHECK: lshr {{.*}} 3
-; Check for ASAN's Offset for 64-bit (7fff8000)
-; CHECK-NEXT: add{{.*}}2147450880
+; CHECK-S3: lshr {{.*}} 3
+; CHECK-S5: lshr {{.*}} 5
+; Check for ASAN's Offset for 64-bit (7fff8000|7ffe0000)
+; CHECK-S3-NEXT: add{{.*}}2147450880
+; CHECK-S5-NEXT: add{{.*}}2147352576
; CHECK: ret
define void @example_atomicrmw(i64* %ptr) nounwind uwtable sanitize_address {
@@ -20,7 +23,8 @@ entry:
}
; CHECK-LABEL: @example_atomicrmw
-; CHECK: lshr {{.*}} 3
+; CHECK-S3: lshr {{.*}} 3
+; CHECK-S5: lshr {{.*}} 5
; CHECK: __asan_report_store8
; CHECK-NOT: __asan_report
; CHECK: atomicrmw
@@ -33,7 +37,8 @@ entry:
}
; CHECK-LABEL: @example_cmpxchg
-; CHECK: lshr {{.*}} 3
+; CHECK-S3: lshr {{.*}} 3
+; CHECK-S5: lshr {{.*}} 5
; CHECK: __asan_report_store8
; CHECK-NOT: __asan_report
; CHECK: cmpxchg
More information about the llvm-commits
mailing list