Skip to content

[HWASan] add test for hwasan_symbolize of stack uas #95186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

fmayer
Copy link
Contributor

@fmayer fmayer commented Jun 12, 2024

No description provided.

Created using spr 1.3.4
@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Florian Mayer (fmayer)

Changes

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 --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;
+}

@fmayer fmayer requested a review from vitalybuka June 12, 2024 01:17
Copy link

github-actions bot commented Jun 12, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

Created using spr 1.3.4
fmayer added 2 commits June 12, 2024 11:01
Created using spr 1.3.4
Created using spr 1.3.4
@fmayer fmayer merged commit 389142e into main Jun 13, 2024
6 checks passed
@fmayer fmayer deleted the users/fmayer/spr/hwasan-add-test-for-hwasan_symbolize-of-stack-uas branch June 13, 2024 16:56
EthanLuisMcDonough pushed a commit to EthanLuisMcDonough/llvm-project that referenced this pull request Aug 13, 2024
fmayer added a commit to fmayer/llvm-project that referenced this pull request Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants