| OLD | NEW |
| 1 ; Verify that ASan properly catches and reports bugs | 1 ; Verify that ASan properly catches and reports bugs |
| 2 | 2 |
| 3 ; REQUIRES: no_minimal_build | 3 ; REQUIRES: no_minimal_build |
| 4 | 4 |
| 5 ; check with a one off the end local access | 5 ; check with a one off the end local access |
| 6 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 6 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
| 7 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ | 7 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ |
| 8 ; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck %s | 8 ; RUN: %t.pexe -o %t && %t 2>&1 | FileCheck %s |
| 9 | 9 |
| 10 ; check with a many off the end local access | 10 ; check with a many off the end local access |
| 11 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 11 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
| 12 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ | 12 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ |
| 13 ; RUN: %t.pexe -o %t && %t 1 2>&1 | FileCheck %s | 13 ; RUN: %t.pexe -o %t && %t 1 2>&1 | FileCheck %s |
| 14 | 14 |
| 15 ; check with a one before the front local access | 15 ; check with a one before the front local access |
| 16 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 16 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
| 17 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ | 17 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ |
| 18 ; RUN: %t.pexe -o %t && %t 1 2 2>&1 | FileCheck %s | 18 ; RUN: %t.pexe -o %t && %t 1 2 2>&1 | FileCheck %s |
| 19 | 19 |
| 20 ; check with a one off the end global access | 20 ; check with a one off the end global access |
| 21 ; RUIN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 21 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
| 22 ; RUIN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ | 22 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ |
| 23 ; RUIN: %t.pexe -o %t && %t 1 2 3 2>&1 | FileCheck %s | 23 ; RUN: %t.pexe -o %t && %t 1 2 3 2>&1 | FileCheck %s |
| 24 | 24 |
| 25 ; check with a many off the end global access | 25 ; check with a many off the end global access |
| 26 ; RUIN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 26 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
| 27 ; RUIN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ | 27 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ |
| 28 ; RUIN: %t.pexe -o %t && %t 1 2 3 4 2>&1 | FileCheck %s | 28 ; RUN: %t.pexe -o %t && %t 1 2 3 4 2>&1 | FileCheck %s |
| 29 | 29 |
| 30 ; check with a one before the front global access | 30 ; check with a one before the front global access |
| 31 ; RUIN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ | 31 ; RUN: llvm-as %s -o - | pnacl-freeze > %t.pexe && %S/../../pydir/szbuild.py \ |
| 32 ; RUIN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ | 32 ; RUN: --fsanitize-address --sz="-allow-externally-defined-symbols" \ |
| 33 ; RUIN: %t.pexe -o %t && %t 1 2 3 4 5 2>&1 | FileCheck %s | 33 ; RUN: %t.pexe -o %t && %t 1 2 3 4 5 2>&1 | FileCheck %s |
| 34 | 34 |
| 35 | 35 |
| 36 declare external void @exit(i32) | 36 declare external void @exit(i32) |
| 37 | 37 |
| 38 ; A global array | 38 ; A global array |
| 39 @array = internal constant [12 x i8] zeroinitializer | 39 @array = internal constant [12 x i8] zeroinitializer |
| 40 | 40 |
| 41 define i32 @access(i32 %is_local_i, i32 %err) { | 41 define i32 @access(i32 %is_local_i, i32 %err) { |
| 42 ; get the base pointer to either the local or global array | 42 ; get the base pointer to either the local or global array |
| 43 %local = alloca i8, i32 12, align 1 | 43 %local = alloca i8, i32 12, align 1 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 61 ret i32 %result | 61 ret i32 %result |
| 62 } | 62 } |
| 63 | 63 |
| 64 ; use argc to determine which test routine to run | 64 ; use argc to determine which test routine to run |
| 65 define void @_start(i32 %arg) { | 65 define void @_start(i32 %arg) { |
| 66 %argcaddr = add i32 %arg, 8 | 66 %argcaddr = add i32 %arg, 8 |
| 67 %argcptr = inttoptr i32 %argcaddr to i32* | 67 %argcptr = inttoptr i32 %argcaddr to i32* |
| 68 %argc = load i32, i32* %argcptr, align 1 | 68 %argc = load i32, i32* %argcptr, align 1 |
| 69 switch i32 %argc, label %error [i32 1, label %one_local | 69 switch i32 %argc, label %error [i32 1, label %one_local |
| 70 i32 2, label %many_local | 70 i32 2, label %many_local |
| 71 i32 3, label %neg_local] | 71 i32 3, label %neg_local |
| 72 i32 4, label %one_global |
| 73 i32 5, label %many_global |
| 74 i32 6, label %neg_global] |
| 72 one_local: | 75 one_local: |
| 73 ; Access one past the end | 76 ; Access one past the end of a local |
| 74 %__0 = call i32 @access(i32 1, i32 0) | 77 call i32 @access(i32 1, i32 0) |
| 75 br label %error | 78 br label %error |
| 76 many_local: | 79 many_local: |
| 77 ; Access five past the end | 80 ; Access five past the end of a local |
| 78 %__1 = call i32 @access(i32 1, i32 4) | 81 call i32 @access(i32 1, i32 4) |
| 79 br label %error | 82 br label %error |
| 80 neg_local: | 83 neg_local: |
| 81 ; Access one before the beginning | 84 ; Access one before the beginning of a local |
| 82 %__2 = call i32 @access(i32 1, i32 -1) | 85 call i32 @access(i32 1, i32 -1) |
| 86 br label %error |
| 87 one_global: |
| 88 ; Access one past the end of a global |
| 89 call i32 @access(i32 0, i32 0) |
| 90 br label %error |
| 91 many_global: |
| 92 ; Access five past the end of a global |
| 93 call i32 @access(i32 0, i32 4) |
| 94 br label %error |
| 95 neg_global: |
| 96 ; Access one before the beginning of a global |
| 97 call i32 @access(i32 0, i32 -1) |
| 83 br label %error | 98 br label %error |
| 84 error: | 99 error: |
| 85 call void @exit(i32 1) | 100 call void @exit(i32 1) |
| 86 unreachable | 101 unreachable |
| 87 } | 102 } |
| 88 | 103 |
| 89 ; CHECK: Illegal access of 4 bytes at | 104 ; CHECK: Illegal access of 4 bytes at |
| OLD | NEW |