[compiler-rt] f3e3a1d - [dfsan] extend a test case to measure origin memory usage
Jianzhou Zhao via llvm-commits
llvm-commits at lists.llvm.org
Wed May 5 17:20:19 PDT 2021
Author: Jianzhou Zhao
Date: 2021-05-06T00:19:44Z
New Revision: f3e3a1d79eee878bb2816ded1a007e71a4fca7e1
URL: https://github.com/llvm/llvm-project/commit/f3e3a1d79eee878bb2816ded1a007e71a4fca7e1
DIFF: https://github.com/llvm/llvm-project/commit/f3e3a1d79eee878bb2816ded1a007e71a4fca7e1.diff
LOG: [dfsan] extend a test case to measure origin memory usage
This is to support D101204.
Reviewed By: gbalats
Differential Revision: https://reviews.llvm.org/D101877
Added:
Modified:
compiler-rt/test/dfsan/release_shadow_space.c
Removed:
################################################################################
diff --git a/compiler-rt/test/dfsan/release_shadow_space.c b/compiler-rt/test/dfsan/release_shadow_space.c
index bdeafdbb6135e..5e4298ffa12e2 100644
--- a/compiler-rt/test/dfsan/release_shadow_space.c
+++ b/compiler-rt/test/dfsan/release_shadow_space.c
@@ -1,5 +1,7 @@
// DFSAN_OPTIONS=no_huge_pages_for_shadow=false RUN: %clang_dfsan %s -o %t && setarch `uname -m` -R %run %t
// DFSAN_OPTIONS=no_huge_pages_for_shadow=true RUN: %clang_dfsan %s -o %t && setarch `uname -m` -R %run %t
+// DFSAN_OPTIONS=no_huge_pages_for_shadow=false RUN: %clang_dfsan %s -DORIGIN_TRACKING -mllvm -dfsan-fast-16-labels -mllvm -dfsan-track-origins=1 -o %t && setarch `uname -m` -R %run %t
+// DFSAN_OPTIONS=no_huge_pages_for_shadow=true RUN: %clang_dfsan %s -DORIGIN_TRACKING -mllvm -dfsan-fast-16-labels -mllvm -dfsan-track-origins=1 -o %t && setarch `uname -m` -R %run %t
//
// REQUIRES: x86_64-target-arch
@@ -72,9 +74,16 @@ int main(int argc, char **argv) {
const size_t mmap_cost_kb = map_size >> 10;
const size_t mmap_shadow_cost_kb = sizeof(dfsan_label) * mmap_cost_kb;
+#ifdef ORIGIN_TRACKING
+ const size_t mmap_origin_cost_kb = mmap_cost_kb;
+#else
+ const size_t mmap_origin_cost_kb = 0;
+#endif
assert(after_mmap >= before + mmap_cost_kb);
- assert(after_mmap_and_set_label >= after_mmap + mmap_shadow_cost_kb);
- assert(after_mmap_and_set_label2 >= before + mmap_cost_kb + mmap_shadow_cost_kb);
+ assert(after_mmap_and_set_label >=
+ after_mmap + mmap_shadow_cost_kb + mmap_origin_cost_kb);
+ assert(after_mmap_and_set_label2 >=
+ before + mmap_cost_kb + mmap_shadow_cost_kb + mmap_origin_cost_kb);
// RSS may not change memory amount after munmap to the same level as the
// start of the program. The assert checks the memory up to a delta.
More information about the llvm-commits
mailing list