[compiler-rt] 8ccc8b1 - [test] Added test for secondary allocator shadow release

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 16:14:44 PDT 2023


Author: Vitaly Buka
Date: 2023-07-25T16:14:33-07:00
New Revision: 8ccc8b19a16a231aa773a61bbbde26da02b72926

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

LOG: [test] Added test for secondary allocator shadow release

Added: 
    compiler-rt/test/hwasan/TestCases/secondary-tag-zero.c

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/hwasan/TestCases/secondary-tag-zero.c b/compiler-rt/test/hwasan/TestCases/secondary-tag-zero.c
new file mode 100644
index 00000000000000..84ce8fb4c825e9
--- /dev/null
+++ b/compiler-rt/test/hwasan/TestCases/secondary-tag-zero.c
@@ -0,0 +1,24 @@
+// Test that tagging of freed large region is 0, which is better for RSS usage.
+// RUN: %clang_hwasan -mllvm -hwasan-globals=0 -mllvm -hwasan-instrument-stack=0 %s -o %t && %run %t 2>&1
+
+// TODO: implement.
+// XFAIL: pointer-tagging
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <sanitizer/hwasan_interface.h>
+
+const int kSize = 10000000;
+
+void *p;
+int main() {
+  for (int i = 0; i < 256; ++i) {
+    p = malloc(kSize);
+    assert(-1 == __hwasan_test_shadow(p, kSize));
+
+    free(p);
+    assert(-1 == __hwasan_test_shadow(__hwasan_tag_pointer(p, 0), kSize));
+  }
+  return 0;
+}


        


More information about the llvm-commits mailing list