[compiler-rt] [HWASan] add test for hwasan_symbolize of stack uas (PR #95186)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 18:17:01 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Florian Mayer (fmayer)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/95186.diff
1 Files Affected:
- (added) compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp (+20)
``````````diff
diff --git a/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp b/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp
new file mode 100644
index 0000000000000..a88f12aaa6a9f
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_hwasan -Wl,--build-id -g %s -o %t
+// RUN: %env_hwasan_opts=symbolize=0 not %run %t 2>&1 | hwasan_symbolize --symbols $(dirname %t) --index | FileCheck %s
+
+#include <sanitizer/hwasan_interface.h>
+#include <stdlib.h>
+
+static volatile char sink;
+
+int main(int argc, char **argv) {
+ volatile char* y;
+ {
+ volatile char x[10];
+ y = &x[0];
+ }
+ sink = *y;
+ // CHECK: Potentially referenced stack object:
+ // CHECK: 0 bytes inside a variable "x" in stack frame of function "main"
+ // CHECK: at {{.*}}hwasan_symbolize_stack_uas.cpp:[[@LINE-6]]
+ return 0;
+}
``````````
</details>
https://github.com/llvm/llvm-project/pull/95186
More information about the llvm-commits
mailing list