tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit fc3765bf0b6c6dec2645b88f14c74933e42c7e35
parent 5baeeceb312bb875ba930e96b381e12d27ae8ff3
Author: Paul Bone <paul@bone.id.au>
Date:   Mon, 24 Nov 2025 01:42:06 +0000

Bug 1969856 - Limit PHC to 128MB of virtual address space r=gsvelto

Differential Revision: https://phabricator.services.mozilla.com/D273369

Diffstat:
Mmemory/build/PHC.cpp | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/memory/build/PHC.cpp b/memory/build/PHC.cpp @@ -365,10 +365,18 @@ static_assert((kPhcAlign % kPageSize) == 0); // PHC will reserve some address space this large, then depending on runtime // configuration will use a smaller fraction of it. Making -// kPhcVirtualReservation the upper-bound of PHC's memory size. On 32bit -// systems with less available address space we choose a more moderate value. +// kPhcVirtualReservation the upper-bound of PHC's memory size. +// * On 32bit systems with less available address space we choose a more +// moderate value. +// * On 64bit systems we set the limit to so that there are no more than 32,768 +// mappings, half of Linux's default limit (Bug 1969856). For 4KB pages +// that's 128MB. #ifdef HAVE_64BIT_BUILD -static const size_t kPhcVirtualReservation = 1024 * 1024 * 1024; +# if defined(XP_DARWIN) && defined(__aarch64__) +static const size_t kPhcVirtualReservation = 512 * 1024 * 1024; +# else +static const size_t kPhcVirtualReservation = 128 * 1024 * 1024; +# endif #else static const size_t kPhcVirtualReservation = 2 * 1024 * 1024; #endif