[compiler-rt] r177278 - tsan: madvise(DONTNEED) shadow memory on munmap()
Dmitry Vyukov
dvyukov at google.com
Mon Mar 18 04:51:51 PDT 2013
Author: dvyukov
Date: Mon Mar 18 06:51:51 2013
New Revision: 177278
URL: http://llvm.org/viewvc/llvm-project?rev=177278&view=rev
Log:
tsan: madvise(DONTNEED) shadow memory on munmap()
Modified:
compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc?rev=177278&r1=177277&r2=177278&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_interceptors.cc Mon Mar 18 06:51:51 2013
@@ -619,6 +619,11 @@ TSAN_INTERCEPTOR(void*, mmap64, void *ad
TSAN_INTERCEPTOR(int, munmap, void *addr, long_t sz) {
SCOPED_TSAN_INTERCEPTOR(munmap, addr, sz);
+ // We are about to unmap a chunk of user memory.
+ // Mark the corresponding shadow memory as not needed.
+ uptr shadow_beg = MemToShadow((uptr)addr);
+ uptr shadow_end = MemToShadow((uptr)addr + sz);
+ FlushUnneededShadowMemory(shadow_beg, shadow_end - shadow_beg);
int res = REAL(munmap)(addr, sz);
return res;
}
More information about the llvm-commits
mailing list