[compiler-rt] 747704e - [tsan] Implement __sanitizer_purge_allocator
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Wed May 24 10:21:34 PDT 2023
Author: Vitaly Buka
Date: 2023-05-24T10:21:22-07:00
New Revision: 747704e34f3a9d1b30e79f3bc12d32527b8c6cdd
URL: https://github.com/llvm/llvm-project/commit/747704e34f3a9d1b30e79f3bc12d32527b8c6cdd
DIFF: https://github.com/llvm/llvm-project/commit/747704e34f3a9d1b30e79f3bc12d32527b8c6cdd.diff
LOG: [tsan] Implement __sanitizer_purge_allocator
Added:
Modified:
compiler-rt/lib/tsan/rtl/tsan_mman.cpp
compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
index e5271cf5697f0..94f850eee0275 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_mman.cpp
@@ -452,6 +452,10 @@ uptr __sanitizer_get_allocated_size(const void *p) {
return user_alloc_usable_size(p);
}
+void __sanitizer_purge_allocator() {
+ allocator()->ForceReleaseToOS();
+}
+
void __tsan_on_thread_idle() {
ThreadState *thr = cur_thread();
allocator()->SwallowCache(&thr->proc()->alloc_cache);
diff --git a/compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp b/compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp
index 815a7964d9414..d43c47f99d0d9 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp
@@ -5,7 +5,7 @@
// UNSUPPORTED: ubsan
// FIXME: implementation is incomplete.
-// XFAIL: msan, lsan, hwasan, tsan
+// XFAIL: msan, lsan, hwasan
#include <assert.h>
#include <sanitizer/allocator_interface.h>
More information about the llvm-commits
mailing list