[compiler-rt] [HWASan] add test for hwasan_symbolize of stack uas (PR #95186)
Florian Mayer via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 11 18:16:33 PDT 2024
https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/95186
None
>From c56ab852b9eb70b83c1c14b93dc653892682ca84 Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Tue, 11 Jun 2024 18:16:17 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.4
---
.../TestCases/hwasan_symbolize_stack_uas.cpp | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
create mode 100644 compiler-rt/test/hwasan/TestCases/hwasan_symbolize_stack_uas.cpp
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;
+}
More information about the llvm-commits
mailing list