[tsan] Implement __sanitizer_purge_allocator
authorVitaly Buka <vitalybuka@google.com>
Wed, 24 May 2023 17:21:03 +0000 (10:21 -0700)
committerVitaly Buka <vitalybuka@google.com>
Wed, 24 May 2023 17:21:22 +0000 (10:21 -0700)
compiler-rt/lib/tsan/rtl/tsan_mman.cpp
compiler-rt/test/sanitizer_common/TestCases/allocator_interface.cpp

index e5271cf..94f850e 100644 (file)
@@ -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);
index 815a796..d43c47f 100644 (file)
@@ -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>