PartitionAlloc: Adds a feature to acquire a zero segment
The zero segment in user-space is similar to Mach-O's __PAGEZERO segment
in that it ensures that a certain range of virtual address space can
never be allocated as writable.
On supported platforms we try to get a zero segment of 4G+1M. This is a
feature required by the V8 Sandbox. Trying to acquire the reservation on
V8 initialization is not robust enough to even make it through the CQ as
sometimes PA randomly allocates memory in this range.
The feature is already enabled for Mac and Linux (not Android or CrOS).
Follow up work will enable this on more platforms.
The feature allows for accommodating different zero segments already
provided by the OSes. It also allows for adding trailing bytes to
accommodate the fact that there may be objects allocated close to the 4G
boundary.
The feature adds a PA API to check whether the segment has been
acquired. This is useful to conditionally enforce getting the segment,
e.g. on the Chrome release binary. It's likely impossible to guarantee
the segment in the general case as there's various helper binaries that
are e.g. invoked through Python or shell helpers.
Bug: 40925855
Change-Id: Iffa039eaa5646b2fb64ff1f787e19a47d109c0ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7768952
Reviewed-by: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Takashi Sakamoto <tasak@google.com>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1620058}
NOKEYCHECK=True
GitOrigin-RevId: 9924b55aea926428b2953715d706f76117800a6e
9 files changed