[compiler-rt] 389142e - [HWASan] add test for hwasan_symbolize of stack uas (#95186)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 13 09:56:48 PDT 2024


Author: Florian Mayer
Date: 2024-06-13T09:56:45-07:00
New Revision: 389142efa0976436aa9210af014a5c92bcb53cdd

URL: https://github.com/llvm/llvm-project/commit/389142efa0976436aa9210af014a5c92bcb53cdd
DIFF: https://github.com/llvm/llvm-project/commit/389142efa0976436aa9210af014a5c92bcb53cdd.diff

LOG: [HWASan] add test for hwasan_symbolize of stack uas (#95186)

Added: 
    compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp

Modified: 
    

Removed: 
    


################################################################################
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..500bc71d5ff06
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp
@@ -0,0 +1,22 @@
+// 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
+
+// REQUIRES: pointer-tagging
+
+#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;
+}


        


More information about the llvm-commits mailing list