Skip to content

Commit 3511022

Browse files
committed
[HWASan] Untag argument to __hwasan_tag_memory.
__hwasan_tag_memory expects untagged pointers, so make sure our pointer is untagged.
1 parent 3f1e827 commit 3511022

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler-rt/test/hwasan/TestCases/hwasan-print-shadow.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
#include <sanitizer/hwasan_interface.h>
99

1010
int main() {
11-
char *p = (char *)malloc(4096);
11+
void *alloc = malloc(4096);
12+
13+
// __hwasan_tag_memory expects untagged pointers.
14+
char *p = (char *)__hwasan_tag_pointer(alloc, 0);
1215
assert(p);
1316

1417
__hwasan_tag_memory(p, 1, 32);
@@ -26,5 +29,5 @@ int main() {
2629
// CHECK-NEXT: {{.*}}0: 0
2730
// CHECK-NEXT: {{.*}}0: 4
2831

29-
free(p);
32+
free(alloc);
3033
}

0 commit comments

Comments
 (0)