Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Unified Diff: tests_lit/asan_tests/wideloads.ll

Issue 2115693002: Implemented loose checking for potential widened loads (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Added test to commit Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests_lit/asan_tests/instrumentstore.ll ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests_lit/asan_tests/wideloads.ll
diff --git a/tests_lit/asan_tests/wideloads.ll b/tests_lit/asan_tests/wideloads.ll
new file mode 100644
index 0000000000000000000000000000000000000000..b1a27bbf91f613b24943fbf7a5a02c8747b88358
--- /dev/null
+++ b/tests_lit/asan_tests/wideloads.ll
@@ -0,0 +1,54 @@
+; Test that potentially widened loads to not trigger an error report
+
+; REQUIRES: no_minimal_build
+
+; check for wide load exception
+; 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
Karl 2016/07/01 21:16:19 Run this through FileCheck --check-prefix=WIDE
tlively 2016/07/02 00:34:06 Done.
+
+; check for error reporting
+; 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 --check-prefix=NOWIDE
+
+
+declare external void @exit(i32)
+
+define internal void @wide_load() {
+ %str = alloca i8, i32 1, align 1
+ %str4 = bitcast i8* %str to i32*
+ %contents = load i32, i32* %str4, align 1
+ call void @exit(i32 0)
+ unreachable
+}
+
+define internal void @no_wide_load() {
+ %str = alloca i8, i32 1, align 1
+ %straddr = ptrtoint i8* %str to i32
+ %off1addr = add i32 %straddr, 1
+ %off1 = inttoptr i32 %off1addr to i8*
+ %contents = load i8, i8* %off1, align 1
+ call void @exit(i32 1)
+ unreachable
+}
+
+; NOWIDE: Illegal access of 1 bytes at
+
+; use argc to determine which test routine to run
+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 %wide_load
+ i32 2, label %no_wide_load]
+wide_load:
+ call void @wide_load()
+ br label %error
+no_wide_load:
+ call void @no_wide_load()
+ br label %error
+error:
+ call void @exit(i32 1)
+ unreachable
+}
« no previous file with comments | « tests_lit/asan_tests/instrumentstore.ll ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698