| 1 | // RUN: %clang_hwasan -g %s -o %t && not %run %t 2>&1 | FileCheck %s |
| 2 | |
| 3 | // Stack histories currently are not recorded on x86. |
| 4 | // XFAIL: target=x86_64{{.*}} |
| 5 | |
| 6 | __attribute((noinline)) void buggy() { |
| 7 | char c[64]; |
| 8 | char *volatile p = c; |
| 9 | p[-2] = 0; |
| 10 | } |
| 11 | |
| 12 | int main() { |
| 13 | buggy(); |
| 14 | // CHECK: WRITE of size 1 at |
| 15 | // CHECK: #0 {{.*}} in buggy{{.*}}stack-underflow.c:[[@LINE-6]] |
| 16 | // CHECK: Cause: stack tag-mismatch |
| 17 | // CHECK: is located in stack of thread |
| 18 | // CHECK: Potentially referenced stack objects: |
| 19 | // CHECK: Cause: stack-buffer-overflow |
| 20 | // CHECK-NEXT: 0x{{.*}} is located 2 bytes before a 64-byte local variable c [0x{{.*}},0x{{.*}}) in buggy {{.*}}stack-underflow.c: |
| 21 | // CHECK: Memory tags around the buggy address |
| 22 | |
| 23 | // CHECK: SUMMARY: HWAddressSanitizer: tag-mismatch {{.*}} in buggy |
| 24 | } |
| 25 | |