From 5dc8a71e37d2743a7b473170aa1cd580ba2d5535 Mon Sep 17 00:00:00 2001 From: not-matthias Date: Mon, 6 Jul 2026 14:35:49 +0200 Subject: [PATCH] fix(aspacem): raise amd64 managed address ceiling to 1 TiB snmalloc-rs as a global allocator aborts under Callgrind because its startup mmap of a flat 256 GiB MAP_NORESERVE range returns EINVAL. On amd64-linux the address-space manager capped the managed range at 128 GiB, placing vStart (the client/Valgrind split) at ~64 GiB, so the largest floating client hole was ~62 GiB and any larger reservation was vetoed by VG_(am_get_advisory). Raise aspacem_maxAddr to 1 TiB (vStart ~512 GiB, ~512 GiB client hole), scoped to VGP_amd64_linux so other 64-bit ports keep 128 GiB (some arm64 kernels expose only a 39-bit user VA). No effect on Callgrind placement semantics; the fork ships only the 64-bit Callgrind tool. Refs COD-3073 --- coregrind/m_aspacemgr/aspacemgr-linux.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/coregrind/m_aspacemgr/aspacemgr-linux.c b/coregrind/m_aspacemgr/aspacemgr-linux.c index 214b4a808..e37507631 100644 --- a/coregrind/m_aspacemgr/aspacemgr-linux.c +++ b/coregrind/m_aspacemgr/aspacemgr-linux.c @@ -1862,7 +1862,17 @@ Addr VG_(am_startup) ( Addr sp_at_startup ) sp_at_startup ); # if VG_WORDSIZE == 8 +# if defined(VGP_amd64_linux) + // Startup inserts a one-page reservation at vStart (the midpoint of + // [minAddr, maxAddr]), splitting the initial free space. A floating + // client mmap searches upward from cStart, so the largest contiguous + // hole it can get runs up to that split, i.e. ~half of maxAddr. 128G + // left only a ~64G client hole, rejecting multi-hundred-GB lazily-backed + // reservations. 1T gives a ~512G hole, well within amd64's 47-bit VA. + aspacem_maxAddr = (Addr)0x10000000000ULL - 1; // 1T +# else aspacem_maxAddr = (Addr)0x2000000000ULL - 1; // 128G +# endif # ifdef ENABLE_INNER { Addr cse = VG_PGROUNDDN( sp_at_startup ) - 1; if (aspacem_maxAddr > cse)