[compiler-rt] b9b8333 - [HWASan] add test for hwasan_handle_longjmp ignore logic (#83359)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 29 15:07:01 PST 2024
Author: Florian Mayer
Date: 2024-02-29T15:06:58-08:00
New Revision: b9b8333ed51b67ab73f8bc4cf25ce400d91e7008
URL: https://github.com/llvm/llvm-project/commit/b9b8333ed51b67ab73f8bc4cf25ce400d91e7008
DIFF: https://github.com/llvm/llvm-project/commit/b9b8333ed51b67ab73f8bc4cf25ce400d91e7008.diff
LOG: [HWASan] add test for hwasan_handle_longjmp ignore logic (#83359)
Added:
compiler-rt/test/hwasan/TestCases/longjmp-out-of-range.c
Modified:
Removed:
################################################################################
diff --git a/compiler-rt/test/hwasan/TestCases/longjmp-out-of-range.c b/compiler-rt/test/hwasan/TestCases/longjmp-out-of-range.c
new file mode 100644
index 00000000000000..2d7ed2ab5ee242
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/longjmp-out-of-range.c
@@ -0,0 +1,20 @@
+// RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
+
+// REQUIRES: pointer-tagging
+#include <assert.h>
+#include <sanitizer/hwasan_interface.h>
+#include <stdlib.h>
+
+__attribute__((noinline)) int f(void *caller_frame) {
+ int z = 0;
+ int *volatile p = &z;
+ // Tag of local is never zero.
+ assert(__hwasan_tag_pointer(p, 0) != p);
+ __hwasan_handle_longjmp(NULL);
+ return p[0];
+}
+
+int main() {
+ return f(__builtin_frame_address(0));
+ // CHECK: HWASan is ignoring requested __hwasan_handle_longjmp:
+}
More information about the llvm-commits
mailing list