| Index: tests_lit/asan_tests/errors.ll
|
| diff --git a/tests_lit/asan_tests/errors.ll b/tests_lit/asan_tests/errors.ll
|
| index e00ed4066d7632554399172c205c09b3c08cc684..3e7f2daf0649f05085ba11b591b1c7cfa7575fae 100644
|
| --- a/tests_lit/asan_tests/errors.ll
|
| +++ b/tests_lit/asan_tests/errors.ll
|
| @@ -2,43 +2,81 @@
|
|
|
| ; REQUIRES: no_minimal_build
|
|
|
| -; check with a one off the end local access
|
| +; check with a one off the end local load
|
| ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| -; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck %s
|
| +; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck --check-prefix=LOCAL-LOAD %s
|
|
|
| -; check with a many off the end local access
|
| +; check with a many off the end local load
|
| ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| -; RUN: %t.pexe -o %t && %t 1 2>&1 | FileCheck %s
|
| +; RUN: %t.pexe -o %t && %t 1 2>&1 | FileCheck --check-prefix=LOCAL-LOAD %s
|
|
|
| -; check with a one before the front local access
|
| +; check with a one before the front local load
|
| ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| -; RUN: %t.pexe -o %t && %t 1 2 2>&1 | FileCheck %s
|
| +; RUN: %t.pexe -o %t && %t 1 2 2>&1 | FileCheck --check-prefix=LOCAL-LOAD %s
|
|
|
| -; check with a one off the end global access
|
| +; check with a one off the end global load
|
| ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| -; RUN: %t.pexe -o %t && %t 1 2 3 2>&1 | FileCheck %s
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=GLOBAL-LOAD %s
|
|
|
| -; check with a many off the end global access
|
| +; check with a many off the end global load
|
| ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| -; RUN: %t.pexe -o %t && %t 1 2 3 4 2>&1 | FileCheck %s
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=GLOBAL-LOAD %s
|
|
|
| -; check with a one before the front global access
|
| +; check with a one before the front global load
|
| ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| ; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| -; RUN: %t.pexe -o %t && %t 1 2 3 4 5 2>&1 | FileCheck %s
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=GLOBAL-LOAD %s
|
|
|
| +; check with a one off the end local store
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 6 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=LOCAL-STORE %s
|
| +
|
| +; check with a many off the end local store
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 6 7 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=LOCAL-STORE %s
|
| +
|
| +; check with a one before the front local store
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 6 7 8 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=LOCAL-STORE %s
|
| +
|
| +; check with a one off the end global store
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 6 7 8 9 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=GLOBAL-STORE %s
|
| +
|
| +; check with a many off the end global store
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 6 7 8 9 10 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=GLOBAL-STORE %s
|
| +
|
| +; check with a one before the front global store
|
| +; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \
|
| +; RUN: --fsanitize-address --sz=-allow-externally-defined-symbols \
|
| +; RUN: %t.pexe -o %t && %t 1 2 3 4 5 6 7 8 9 10 11 2>&1 | FileCheck \
|
| +; RUN: --check-prefix=GLOBAL-STORE %s
|
|
|
| declare external void @exit(i32)
|
|
|
| ; A global array
|
| @array = internal constant [12 x i8] zeroinitializer
|
|
|
| -define void @access(i32 %is_local_i, i32 %err) {
|
| +define void @access(i32 %is_local_i, i32 %is_load_i, i32 %err) {
|
| ; get the base pointer to either the local or global array
|
| %local = alloca i8, i32 12, align 1
|
| %global = bitcast [12 x i8]* @array to i8*
|
| @@ -56,9 +94,17 @@ define void @access(i32 %is_local_i, i32 %err) {
|
| %badaddr = add i32 %arraddr, %offset
|
| %badptr = inttoptr i32 %badaddr to i8*
|
|
|
| - ; perform the bad access
|
| + ; determine load or store
|
| + %is_load = icmp ne i32 %is_load_i, 0
|
| + br i1 %is_load, label %bad_load, label %bad_store
|
| +
|
| +bad_load:
|
| %result = load i8, i8* %badptr, align 1
|
| ret void
|
| +
|
| +bad_store:
|
| + store i8 42, i8* %badptr, align 1
|
| + ret void
|
| }
|
|
|
| ; use argc to determine which test routine to run
|
| @@ -66,39 +112,72 @@ define void @_start(i32 %arg) {
|
| %argcaddr = add i32 %arg, 8
|
| %argcptr = inttoptr i32 %argcaddr to i32*
|
| %argc = load i32, i32* %argcptr, align 1
|
| - switch i32 %argc, label %error [i32 1, label %one_local
|
| - i32 2, label %many_local
|
| - i32 3, label %neg_local
|
| - i32 4, label %one_global
|
| - i32 5, label %many_global
|
| - i32 6, label %neg_global]
|
| -one_local:
|
| + switch i32 %argc, label %error [i32 1, label %one_local_load
|
| + i32 2, label %many_local_load
|
| + i32 3, label %neg_local_load
|
| + i32 4, label %one_global_load
|
| + i32 5, label %many_global_load
|
| + i32 6, label %neg_global_load
|
| + i32 7, label %one_local_store
|
| + i32 8, label %many_local_store
|
| + i32 9, label %neg_local_store
|
| + i32 10, label %one_global_store
|
| + i32 11, label %many_global_store
|
| + i32 12, label %neg_global_store]
|
| +one_local_load:
|
| + ; Access one past the end of a local
|
| + call void @access(i32 1, i32 1, i32 0)
|
| + br label %error
|
| +many_local_load:
|
| + ; Access five past the end of a local
|
| + call void @access(i32 1, i32 1, i32 4)
|
| + br label %error
|
| +neg_local_load:
|
| + ; Access one before the beginning of a local
|
| + call void @access(i32 1, i32 1, i32 -1)
|
| + br label %error
|
| +one_global_load:
|
| + ; Access one past the end of a global
|
| + call void @access(i32 0, i32 1, i32 0)
|
| + br label %error
|
| +many_global_load:
|
| + ; Access five past the end of a global
|
| + call void @access(i32 0, i32 1, i32 4)
|
| + br label %error
|
| +neg_global_load:
|
| + ; Access one before the beginning of a global
|
| + call void @access(i32 0, i32 1, i32 -1)
|
| + br label %error
|
| +one_local_store:
|
| ; Access one past the end of a local
|
| - call void @access(i32 1, i32 0)
|
| + call void @access(i32 1, i32 0, i32 0)
|
| br label %error
|
| -many_local:
|
| +many_local_store:
|
| ; Access five past the end of a local
|
| - call void @access(i32 1, i32 4)
|
| + call void @access(i32 1, i32 0, i32 4)
|
| br label %error
|
| -neg_local:
|
| +neg_local_store:
|
| ; Access one before the beginning of a local
|
| - call void @access(i32 1, i32 -1)
|
| + call void @access(i32 1, i32 0, i32 -1)
|
| br label %error
|
| -one_global:
|
| +one_global_store:
|
| ; Access one past the end of a global
|
| - call void @access(i32 0, i32 0)
|
| + call void @access(i32 0, i32 0, i32 0)
|
| br label %error
|
| -many_global:
|
| +many_global_store:
|
| ; Access five past the end of a global
|
| - call void @access(i32 0, i32 4)
|
| + call void @access(i32 0, i32 0, i32 4)
|
| br label %error
|
| -neg_global:
|
| +neg_global_store:
|
| ; Access one before the beginning of a global
|
| - call void @access(i32 0, i32 -1)
|
| + call void @access(i32 0, i32 0, i32 -1)
|
| br label %error
|
| error:
|
| call void @exit(i32 1)
|
| unreachable
|
| }
|
|
|
| -; CHECK: Illegal access of 1 bytes at
|
| +; LOCAL-LOAD: Illegal 1 byte load from stack object at
|
| +; LOCAL-STORE: Illegal 1 byte store to stack object at
|
| +; GLOBAL-LOAD: Illegal 1 byte load from global object at
|
| +; GLOBAL-STORE: Illegal 1 byte store to global object at
|
|
|