[llvm-branch-commits] [compiler-rt] [hwasan] Make stack variables output consistent with globals (PR #76197)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Dec 21 16:45:18 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Vitaly Buka (vitalybuka)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/76197.diff
6 Files Affected:
- (modified) compiler-rt/lib/hwasan/hwasan_report.cpp (+5-6)
- (modified) compiler-rt/test/hwasan/TestCases/stack-overflow.c (+1-2)
- (modified) compiler-rt/test/hwasan/TestCases/stack-uar-dynamic.c (+1-2)
- (modified) compiler-rt/test/hwasan/TestCases/stack-uar.c (+1-2)
- (modified) compiler-rt/test/hwasan/TestCases/stack-underflow.c (+1-2)
- (modified) compiler-rt/test/hwasan/TestCases/strip_path_prefix.c (+1-1)
``````````diff
diff --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index 3d192d14975319..039fe3cb87dd61 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -258,16 +258,15 @@ static void PrintStackAllocations(const StackAllocationsRingBuffer *sa,
Printf("Cause: %s\n", cause);
Printf("%s", d.Default());
Printf("%s", d.Location());
- Printf("%p is located %zd bytes %s a %zd-byte region [%p,%p)\n",
- untagged_addr, offset, whence, local_end - local_beg, local_beg,
- local_end);
- Printf("%s", d.Allocation());
StackTracePrinter::GetOrInit()->RenderSourceLocation(
&location, local.decl_file, local.decl_line, /* column= */ 0,
common_flags()->symbolize_vs_style,
common_flags()->strip_path_prefix);
- Printf(" %s in %s %s\n", local.name, local.function_name,
- location.data());
+ Printf(
+ "%p is located %zd bytes %s a %zd-byte local variable %s [%p,%p) "
+ "in %s %s\n",
+ untagged_addr, offset, whence, local_end - local_beg, local.name,
+ local_beg, local_end, local.function_name, location.data());
location.clear();
Printf("%s\n", d.Default());
}
diff --git a/compiler-rt/test/hwasan/TestCases/stack-overflow.c b/compiler-rt/test/hwasan/TestCases/stack-overflow.c
index 10e8d9c59e4bb6..4af506e3ecf457 100644
--- a/compiler-rt/test/hwasan/TestCases/stack-overflow.c
+++ b/compiler-rt/test/hwasan/TestCases/stack-overflow.c
@@ -17,8 +17,7 @@ int main() {
// CHECK: is located in stack of thread
// CHECK: Potentially referenced stack objects:
// CHECK: Cause: stack-buffer-overflow
- // CHECK-NEXT: 0x{{.*}} is located 1 bytes after a 64-byte region
- // CHECK-NEXT: c in buggy {{.*}}stack-overflow.c:
+ // CHECK-NEXT: 0x{{.*}} is located 1 bytes after a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy {{.*}}stack-overflow.c:
// CHECK: Memory tags around the buggy address
// CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in buggy
diff --git a/compiler-rt/test/hwasan/TestCases/stack-uar-dynamic.c b/compiler-rt/test/hwasan/TestCases/stack-uar-dynamic.c
index 7a2a11593e7afe..14b9cba8aa5e4d 100644
--- a/compiler-rt/test/hwasan/TestCases/stack-uar-dynamic.c
+++ b/compiler-rt/test/hwasan/TestCases/stack-uar-dynamic.c
@@ -22,7 +22,6 @@ int main() {
char *p = buggy(1);
// CHECK: Potentially referenced stack objects:
// CHECK-NEXT: use-after-scope
- // CHECK-NEXT: 0x{{.*}} is located 0 bytes inside a 64-byte region
- // CHECK-NEXT: c in buggy
+ // CHECK-NEXT: 0x{{.*}} is located 0 bytes inside a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy
p[0] = 0;
}
diff --git a/compiler-rt/test/hwasan/TestCases/stack-uar.c b/compiler-rt/test/hwasan/TestCases/stack-uar.c
index 8810701f0c9cac..9fd4381a8049eb 100644
--- a/compiler-rt/test/hwasan/TestCases/stack-uar.c
+++ b/compiler-rt/test/hwasan/TestCases/stack-uar.c
@@ -51,8 +51,7 @@ int main() {
// CHECK: is located in stack of thread
// CHECK: Potentially referenced stack objects:
// CHECK: Cause: use-after-scope
- // CHECK-NEXT: 0x{{.*}} is located 0 bytes inside a 2048-byte region
- // CHECK-NEXT: {{zzz|yyy}} in buggy {{.*}}stack-uar.c:
+ // CHECK-NEXT: 0x{{.*}} is located 0 bytes inside a 2048-byte local variable {{zzz|yyy}} [0x{{.*}},0x{{.*}}) in buggy {{.*}}stack-uar.c:
// CHECK: Memory tags around the buggy address
// NOSYM: Previously allocated frames:
diff --git a/compiler-rt/test/hwasan/TestCases/stack-underflow.c b/compiler-rt/test/hwasan/TestCases/stack-underflow.c
index 8e5174519272f4..e13955ed37b410 100644
--- a/compiler-rt/test/hwasan/TestCases/stack-underflow.c
+++ b/compiler-rt/test/hwasan/TestCases/stack-underflow.c
@@ -17,8 +17,7 @@ int main() {
// CHECK: is located in stack of thread
// CHECK: Potentially referenced stack objects:
// CHECK: Cause: stack-buffer-overflow
- // CHECK-NEXT: 0x{{.*}} is located 2 bytes before a 64-byte region
- // CHECK-NEXT: c in buggy {{.*}}stack-underflow.c:
+ // CHECK-NEXT: 0x{{.*}} is located 2 bytes before a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy {{.*}}stack-underflow.c:
// CHECK: Memory tags around the buggy address
// CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in buggy
diff --git a/compiler-rt/test/hwasan/TestCases/strip_path_prefix.c b/compiler-rt/test/hwasan/TestCases/strip_path_prefix.c
index 5844749a6d9772..fa271c8bdddc02 100644
--- a/compiler-rt/test/hwasan/TestCases/strip_path_prefix.c
+++ b/compiler-rt/test/hwasan/TestCases/strip_path_prefix.c
@@ -23,5 +23,5 @@ int main() {
// CHECK: READ of size 1 at
// CHECK: #0 {{.*}} in main strip_path_prefix.c:[[@LINE-2]]
// CHECK: Potentially referenced stack objects:
- // CHECK: zzz in buggy strip_path_prefix.c:[[@LINE-12]]
+ // CHECK: in buggy strip_path_prefix.c:[[@LINE-12]]
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/76197
More information about the llvm-branch-commits
mailing list