Commit a92f70d8 authored by Omer Katz's avatar Omer Katz Committed by V8 LUCI CQ

cppgc: Fuchsia can allocate stack below 4GB

crrev.com/c/3069146 fixed a write barrier issue leading to a null
dereference on Windows that was triggered by having the stack allocated
at address below 4GB.
Turns out the same can happen on Fuchsia.

Bug: chromium:1230763, chromium:1056170
Change-Id: I74ba0b465c3230b4274f2c23d279c4f73183eddb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3071402
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Commit-Queue: Anton Bikineev <bikineev@chromium.org>
Auto-Submit: Omer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76094}
parent f41476bf
......@@ -167,7 +167,7 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final {
static V8_INLINE bool TryGetCagedHeap(const void* slot, const void* value,
WriteBarrier::Params& params) {
#if defined(V8_OS_WIN)
#if V8_OS_WIN || V8_OS_FUCHSIA
// This method assumes that the stack is allocated in high
// addresses. That is not guaranteed on Windows. Having a low-address
// (below api_constants::kCagedHeapReservationSize) on-stack slot with a
......@@ -177,7 +177,7 @@ class V8_EXPORT WriteBarrierTypeForCagedHeapPolicy final {
// OSes where the stack resides in higher adderesses, and to keep the write
// barrier as cheap as possible.
if (!value) return false;
#endif // V8_OS_WIN
#endif // V8_OS_WIN || V8_OS_FUCHSIA
params.start = reinterpret_cast<uintptr_t>(value) &
~(api_constants::kCagedHeapReservationAlignment - 1);
const uintptr_t slot_offset =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment