Commit 0e063d49 authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[mac][rwx] Fix MemoryAllocator::PartialFreeMemory()

... which shouldn't try to change permissions of RWX pages.

Bug: v8:12797
Change-Id: Ibf3de06f5243c2008a8d9dc41f6231373f844e40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3700352
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81099}
parent 18a87b4f
......@@ -416,9 +416,15 @@ void MemoryAllocator::PartialFreeMemory(BasicMemoryChunk* chunk,
DCHECK_EQ(0, chunk->area_end() % static_cast<Address>(page_size));
DCHECK_EQ(chunk->address() + chunk->size(),
chunk->area_end() + MemoryChunkLayout::CodePageGuardSize());
if (V8_HEAP_USE_PTHREAD_JIT_WRITE_PROTECT && !isolate_->jitless()) {
DCHECK(isolate_->RequiresCodeRange());
reservation->DiscardSystemPages(chunk->area_end(), page_size);
} else {
reservation->SetPermissions(chunk->area_end(), page_size,
PageAllocator::kNoAccess);
}
}
// On e.g. Windows, a reservation may be larger than a page and releasing
// partially starting at |start_free| will also release the potentially
// unused part behind the current page.
......@@ -686,10 +692,10 @@ bool MemoryAllocator::SetPermissionsOnExecutableMemoryChunk(VirtualMemory* vm,
const Address code_area = start + code_area_offset;
const Address post_guard_page = start + chunk_size - guard_size;
bool jitless = unmapper_.heap_->isolate()->jitless();
bool jitless = isolate_->jitless();
if (V8_HEAP_USE_PTHREAD_JIT_WRITE_PROTECT && !jitless) {
DCHECK(unmapper_.heap_->isolate()->RequiresCodeRange());
DCHECK(isolate_->RequiresCodeRange());
// Commit the header, from start to pre-code guard page.
// We have to commit it as executable becase otherwise we'll not be able
// to change permissions to anything else.
......
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