Skip to content

Commit bd0fc48

Browse files
authored
[sanitizer_common] Use 38-bit mmap range for Fuchsia (#69387)
46cb8d9 unconditionally changed the mmap range to 2^48 for all riscv sanitizers. This changes the allocator tunings for the 32-bit allocator for riscv and led to a severe performance regression for our lsan tests. This effectively revers the tuning change but only for Fuchsia. Once we enable the 64-bit allocator for everything riscv, this value will be irrelevant since it's only relevant for the 32-bit allocator.
1 parent 16a5c71 commit bd0fc48

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,15 @@
303303
# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 40)
304304
# endif
305305
#elif SANITIZER_RISCV64
306-
# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47)
306+
// FIXME: Rather than hardcoding the VMA here, we should rely on
307+
// GetMaxUserVirtualAddress(). This will require some refactoring though since
308+
// many places either hardcode some value or SANITIZER_MMAP_RANGE_SIZE is
309+
// assumed to be some constant integer.
310+
# if SANITIZER_FUCHSIA
311+
# define SANITIZER_MMAP_RANGE_SIZE (1ULL << 38)
312+
# else
313+
# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47)
314+
# endif
307315
#elif defined(__aarch64__)
308316
# if SANITIZER_APPLE
309317
# if SANITIZER_OSX || SANITIZER_IOSSIM

0 commit comments

Comments
 (0)