Skip to content

Commit 52467ac

Browse files
committed
[asan] Switch allocator to dynamic base address
This ports a proposed memprof fix (llvm#98510), which has a shadow memory and allocator layout that is similar to ASan. Although we have only observed the failure for memprof on a buildbot [*], it could theoretically happen for ASan. asan_rtl.cpp calls InitializeShadowMemory() - which dynamically/"randomly" chooses a base address for the shadow mapping - prior to InitializeAllocator(). If we are unlucky, the shadow memory may be mapped in the same region where the allocator wants to be. This patch fixes the issue by changing the allocator to dynamically choosing a base address, as suggested by Vitaly. For comparison, HWASan already dynamically chooses the base addresses for the shadow mapping and allocator. [*] https://lab.llvm.org/buildbot/#/builders/66/builds/1361/steps/17/logs/stdio
1 parent 90ccf21 commit 52467ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler-rt/lib/asan/asan_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ const uptr kAllocatorSpace = 0x600000000000ULL;
214214
const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
215215
typedef DefaultSizeClassMap SizeClassMap;
216216
# else
217-
const uptr kAllocatorSpace = 0x500000000000ULL;
217+
const uptr kAllocatorSpace = ~(uptr)0;
218218
const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
219219
typedef DefaultSizeClassMap SizeClassMap;
220220
# endif

0 commit comments

Comments
 (0)