[compiler-rt] be59a33 - [hwasan] Fix test on x86.

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 10 05:06:26 PDT 2021


Author: Florian Mayer
Date: 2021-08-10T13:06:12+01:00
New Revision: be59a332eb3b965bd86c9b08feaae1d5e77a4bb5

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

LOG: [hwasan] Fix test on x86.

Reviewed By: dvyukov

Differential Revision: https://reviews.llvm.org/D107816

Added: 
    

Modified: 
    compiler-rt/test/hwasan/TestCases/double-free.c
    compiler-rt/test/hwasan/TestCases/use-after-free.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/hwasan/TestCases/double-free.c b/compiler-rt/test/hwasan/TestCases/double-free.c
index 561d4bc417209..f77c27cf687d6 100644
--- a/compiler-rt/test/hwasan/TestCases/double-free.c
+++ b/compiler-rt/test/hwasan/TestCases/double-free.c
@@ -13,7 +13,10 @@ int main() {
   free(x);
   // CHECK: ERROR: HWAddressSanitizer: invalid-free on address {{.*}} at pc {{[0x]+}}[[PC:.*]] on thread T{{[0-9]+}}
   // CHECK: tags: [[PTR_TAG:..]]/[[MEM_TAG:..]] (ptr/mem)
-  // CHECK: #0 {{[0x]+}}{{.*}}[[PC]] in free
+  // CHECK: #0 {{[0x]+}}{{.*}}[[PC]]
+  // If we instrument using calls (default on x86), free is not the top frame
+  // of the fault.
+  // CHECK: in free
   // CHECK: freed by thread {{.*}} here:
   // CHECK: previously allocated here:
   // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes):

diff  --git a/compiler-rt/test/hwasan/TestCases/use-after-free.c b/compiler-rt/test/hwasan/TestCases/use-after-free.c
index 9b750aaaad85c..94a8939162d0d 100644
--- a/compiler-rt/test/hwasan/TestCases/use-after-free.c
+++ b/compiler-rt/test/hwasan/TestCases/use-after-free.c
@@ -22,7 +22,10 @@ int main() {
   if (ISREAD) r = x[5]; else x[5] = 42;  // should be on the same line.
   // CHECK: ERROR: HWAddressSanitizer: tag-mismatch on address {{.*}} at pc {{[0x]+}}[[PC:.*]]
   // CHECK: [[TYPE]] of size 1 at {{.*}} tags: [[PTR_TAG:[0-9a-f][0-9a-f]]]/[[MEM_TAG:[0-9a-f][0-9a-f]]] (ptr/mem)
-  // CHECK: #{{[0-9]}} {{[0-9]+}}{{.*}}[[PC]] in main {{.*}}use-after-free.c:[[@LINE-3]]
+  // CHECK: #{{[0-9]}} {{[0-9]+}}{{.*}}[[PC]]
+  // If we instrument using calls (default on x86), main is not the top frame
+  // of the fault.
+  // CHECK: in main {{.*}}use-after-free.c:[[@LINE-6]]
   // Offset is 5 or 11 depending on left/right alignment.
   // CHECK: is a small unallocated heap chunk; size: 32 offset: {{5|11}}
   // CHECK: Cause: use-after-free
@@ -30,11 +33,11 @@ int main() {
   //
   // CHECK: freed by thread {{.*}} here:
   // CHECK: #0 {{.*}} in {{.*}}free{{.*}} {{.*}}hwasan_allocation_functions.cpp
-  // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-16]]
+  // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-19]]
 
   // CHECK: previously allocated here:
   // CHECK: #0 {{.*}} in {{.*}}malloc{{.*}} {{.*}}hwasan_allocation_functions.cpp
-  // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-21]]
+  // CHECK: #1 {{.*}} in main {{.*}}use-after-free.c:[[@LINE-24]]
   // CHECK: Memory tags around the buggy address (one tag corresponds to 16 bytes):
   // CHECK: =>{{.*}}[[MEM_TAG]]
   // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch


        


More information about the llvm-commits mailing list