Skip to content

Commit b9b8333

Browse files
authored
[HWASan] add test for hwasan_handle_longjmp ignore logic (#83359)
1 parent bf0f874 commit b9b8333

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %clang_hwasan -O0 %s -o %t && %run %t 2>&1 | FileCheck %s
2+
3+
// REQUIRES: pointer-tagging
4+
#include <assert.h>
5+
#include <sanitizer/hwasan_interface.h>
6+
#include <stdlib.h>
7+
8+
__attribute__((noinline)) int f(void *caller_frame) {
9+
int z = 0;
10+
int *volatile p = &z;
11+
// Tag of local is never zero.
12+
assert(__hwasan_tag_pointer(p, 0) != p);
13+
__hwasan_handle_longjmp(NULL);
14+
return p[0];
15+
}
16+
17+
int main() {
18+
return f(__builtin_frame_address(0));
19+
// CHECK: HWASan is ignoring requested __hwasan_handle_longjmp:
20+
}

0 commit comments

Comments
 (0)