Index: compiler-rt/lib/asan/asan_fuchsia.cc =================================================================== --- compiler-rt/lib/asan/asan_fuchsia.cc +++ compiler-rt/lib/asan/asan_fuchsia.cc @@ -196,6 +196,9 @@ return false; } +void FlushUnneededASanShadowMemory(uptr p, uptr size) { +} + } // namespace __asan // These are declared (in extern "C") by . Index: compiler-rt/lib/asan/asan_linux.cc =================================================================== --- compiler-rt/lib/asan/asan_linux.cc +++ compiler-rt/lib/asan/asan_linux.cc @@ -254,6 +254,12 @@ return false; } +void FlushUnneededASanShadowMemory(uptr p, uptr size) { + // Since asan's mapping is compacting, the shadow chunk may be + // not page-aligned, so we only flush the page-aligned portion. + ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); +} + } // namespace __asan #endif // SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD || Index: compiler-rt/lib/asan/asan_mac.cc =================================================================== --- compiler-rt/lib/asan/asan_mac.cc +++ compiler-rt/lib/asan/asan_mac.cc @@ -203,6 +203,12 @@ asan_free(context, &stack, FROM_MALLOC); } +void FlushUnneededASanShadowMemory(uptr p, uptr size) { + // Since asan's mapping is compacting, the shadow chunk may be + // not page-aligned, so we only flush the page-aligned portion. + ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); +} + } // namespace __asan using namespace __asan; // NOLINT Index: compiler-rt/lib/asan/asan_poisoning.cc =================================================================== --- compiler-rt/lib/asan/asan_poisoning.cc +++ compiler-rt/lib/asan/asan_poisoning.cc @@ -62,12 +62,6 @@ } }; -void FlushUnneededASanShadowMemory(uptr p, uptr size) { - // Since asan's mapping is compacting, the shadow chunk may be - // not page-aligned, so we only flush the page-aligned portion. - ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); -} - void AsanPoisonOrUnpoisonIntraObjectRedzone(uptr ptr, uptr size, bool poison) { uptr end = ptr + size; if (Verbosity()) { Index: compiler-rt/lib/asan/asan_win.cc =================================================================== --- compiler-rt/lib/asan/asan_win.cc +++ compiler-rt/lib/asan/asan_win.cc @@ -370,6 +370,12 @@ WIN_FORCE_LINK(__asan_dso_reg_hook) +void FlushUnneededASanShadowMemory(uptr p, uptr size) { + // Since asan's mapping is compacting, the shadow chunk may be + // not page-aligned, so we only flush the page-aligned portion. + ReleaseMemoryPagesToOS(MemToShadow(p), MemToShadow(p + size)); +} + // }}} } // namespace __asan