Index: compiler-rt/lib/asan/asan_rtl.cc =================================================================== --- compiler-rt/lib/asan/asan_rtl.cc +++ compiler-rt/lib/asan/asan_rtl.cc @@ -408,6 +408,7 @@ // Setup internal allocator callback. SetLowLevelAllocateCallback(OnLowLevelAllocate); + SetLowLevelAllocateMinAlignment(SHADOW_GRANULARITY); InitializeAsanInterceptors(); Index: compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc +++ compiler-rt/lib/sanitizer_common/sanitizer_allocator.cc @@ -179,10 +179,11 @@ // LowLevelAllocator static LowLevelAllocateCallback low_level_alloc_callback; +static uptr low_level_alloc_min_alignment = 8; void *LowLevelAllocator::Allocate(uptr size) { // Align allocation size. - size = RoundUpTo(size, 8); + size = RoundUpTo(size, low_level_alloc_min_alignment); if (allocated_end_ - allocated_current_ < (sptr)size) { uptr size_to_allocate = Max(size, GetPageSizeCached()); allocated_current_ = @@ -203,6 +204,12 @@ low_level_alloc_callback = callback; } +void SetLowLevelAllocateMinAlignment(uptr alignment) { + CHECK(IsPowerOfTwo(alignment)); + if (low_level_alloc_min_alignment < alignment) + low_level_alloc_min_alignment = alignment; +} + static atomic_uint8_t allocator_out_of_memory = {0}; static atomic_uint8_t allocator_may_return_null = {0}; Index: compiler-rt/lib/sanitizer_common/sanitizer_common.h =================================================================== --- compiler-rt/lib/sanitizer_common/sanitizer_common.h +++ compiler-rt/lib/sanitizer_common/sanitizer_common.h @@ -209,6 +209,7 @@ // Allows to register tool-specific callbacks for LowLevelAllocator. // Passing NULL removes the callback. void SetLowLevelAllocateCallback(LowLevelAllocateCallback callback); +void SetLowLevelAllocateMinAlignment(uptr alignment); // IO void CatastrophicErrorWrite(const char *buffer, uptr length);