diff options
author | Petr Hosek <phosek@chromium.org> | 2019-07-11 07:30:11 +0000 |
---|---|---|
committer | Petr Hosek <phosek@chromium.org> | 2019-07-11 07:30:11 +0000 |
commit | 2dff76d9e1a6b7ab9f871624e3572b56815b3050 (patch) | |
tree | 9c5df42c1d1d005ca5d17759801a04b4ef060a07 | |
parent | 642fb76849b9c4f557a83eb261065ff3cf85165e (diff) | |
download | compiler-rt-2dff76d9e1a6b7ab9f871624e3572b56815b3050.tar.gz |
[ASan] Use __sanitizer_fill_shadow for FastPoisonShadow on Fuchsia
This is the optimized implementation for Fuchsia provided by the libc.
Differential Revision: https://reviews.llvm.org/D64166
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@365739 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/asan/asan_poisoning.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/asan/asan_poisoning.h b/lib/asan/asan_poisoning.h index ca14d11fd..62dd9bd0e 100644 --- a/lib/asan/asan_poisoning.h +++ b/lib/asan/asan_poisoning.h @@ -15,6 +15,7 @@ #include "asan_internal.h" #include "asan_mapping.h" #include "sanitizer_common/sanitizer_flags.h" +#include "sanitizer_common/sanitizer_platform.h" namespace __asan { @@ -38,6 +39,10 @@ void PoisonShadowPartialRightRedzone(uptr addr, ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size, u8 value) { DCHECK(!value || CanPoisonMemory()); +#if SANITIZER_FUCHSIA + __sanitizer_fill_shadow(aligned_beg, aligned_size, value, + common_flags()->clear_shadow_mmap_threshold); +#else uptr shadow_beg = MEM_TO_SHADOW(aligned_beg); uptr shadow_end = MEM_TO_SHADOW( aligned_beg + aligned_size - SHADOW_GRANULARITY) + 1; @@ -46,10 +51,6 @@ ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size, // probably provide higher-level interface for these operations. // For now, just memset on Windows. if (value || SANITIZER_WINDOWS == 1 || - // TODO(mcgrathr): Fuchsia doesn't allow the shadow mapping to be - // changed at all. It doesn't currently have an efficient means - // to zero a bunch of pages, but maybe we should add one. - SANITIZER_FUCHSIA == 1 || // RTEMS doesn't have have pages, let alone a fast way to zero // them, so default to memset. SANITIZER_RTEMS == 1 || @@ -72,6 +73,7 @@ ALWAYS_INLINE void FastPoisonShadow(uptr aligned_beg, uptr aligned_size, ReserveShadowMemoryRange(page_beg, page_end - 1, nullptr); } } +#endif // SANITIZER_FUCHSIA } ALWAYS_INLINE void FastPoisonShadowPartialRightRedzone( |