Skip to content

Commit b12e141

Browse files
[memprof] Switch allocator to dynamic base address (#98510)
memprof_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. The "unlucky" failure was observed on a new buildbot: https://lab.llvm.org/buildbot/#/builders/66/builds/1361/steps/17/logs/stdio --------- Co-authored-by: Vitaly Buka <[email protected]>
1 parent 90abdf8 commit b12e141

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

compiler-rt/lib/memprof/memprof_allocator.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ struct MemprofMapUnmapCallback {
4646
void OnUnmap(uptr p, uptr size) const;
4747
};
4848

49-
#if SANITIZER_APPLE
50-
constexpr uptr kAllocatorSpace = 0x600000000000ULL;
51-
#else
52-
constexpr uptr kAllocatorSpace = 0x500000000000ULL;
53-
#endif
49+
constexpr uptr kAllocatorSpace = ~(uptr)0;
5450
constexpr uptr kAllocatorSize = 0x40000000000ULL; // 4T.
5551
typedef DefaultSizeClassMap SizeClassMap;
5652
template <typename AddressSpaceViewTy>

0 commit comments

Comments
 (0)