summaryrefslogtreecommitdiff
path: root/compiler-rt/test
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2023-04-28 18:31:03 -0700
committerVitaly Buka <vitalybuka@google.com>2023-04-28 18:31:03 -0700
commitedc696093199ee72a282a20237daeda512d15028 (patch)
tree6323440f226bb8437acb8cb1a9dca28c20c39b3a /compiler-rt/test
parent008c3934ab6b3a6dfcbb81f6258b9e03e9b61c1c (diff)
downloadllvm-edc696093199ee72a282a20237daeda512d15028.tar.gz
Revert "[HWASAN] Support short granules in __hwasan_test_shadow"
Acidentally relanded without the fix. This reverts commit 008c3934ab6b3a6dfcbb81f6258b9e03e9b61c1c.
Diffstat (limited to 'compiler-rt/test')
-rw-r--r--compiler-rt/test/hwasan/TestCases/test_shadow.c41
1 files changed, 0 insertions, 41 deletions
diff --git a/compiler-rt/test/hwasan/TestCases/test_shadow.c b/compiler-rt/test/hwasan/TestCases/test_shadow.c
deleted file mode 100644
index 693ba255a030..000000000000
--- a/compiler-rt/test/hwasan/TestCases/test_shadow.c
+++ /dev/null
@@ -1,41 +0,0 @@
-// RUN: %clang_hwasan %s -o %t && %run %t
-
-#include <assert.h>
-#include <sanitizer/hwasan_interface.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-int main() {
- __hwasan_enable_allocator_tagging();
- for (int sz = 0; sz < 64; ++sz) {
- fprintf(stderr, "sz: %d\n", sz);
- char *x = (char *)malloc(sz);
- do {
- // Empty range is always OK.
- for (int b = -16; b < sz + 32; ++b)
- assert(__hwasan_test_shadow(x + b, 0) == -1);
-
- int real_sz = sz ? sz : 1;
- // Unlucky case when we cant distinguish between tag and short granule size.
- if (__hwasan_tag_pointer(x, real_sz % 16) == x)
- break;
-
- // Underflow - the first byte is bad.
- for (int b = -16; b < 0; ++b)
- assert(__hwasan_test_shadow(x + b, real_sz) == 0);
-
- // Inbound ranges.
- for (int b = 0; b < real_sz; ++b)
- for (int e = b; e <= real_sz; ++e)
- assert(__hwasan_test_shadow(x + b, e - b) == -1);
-
- // Overflow - the first byte after the buffer is bad.
- for (int b = 0; b <= real_sz; ++b)
- for (int e = real_sz + 1; e <= real_sz + 64; ++e)
- assert(__hwasan_test_shadow(x + b, e - b) == (real_sz - b));
-
- } while (0);
- free(x);
- }
- return 0;
-}