Commit 986254d2 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Introduce mutex for executable memory data structure

Lookups and updates to the executable_memory_ unordered_map need to be
protected with mutex.

Bug: v8:10315, v8:10546
Change-Id: Ic17e19d1e4fda18b99103a96052940e68e970586
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2208867Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67902}
parent e19eb649
......@@ -330,12 +330,14 @@ class MemoryAllocator {
}
void RegisterExecutableMemoryChunk(MemoryChunk* chunk) {
base::MutexGuard guard(&executable_memory_mutex_);
DCHECK(chunk->IsFlagSet(MemoryChunk::IS_EXECUTABLE));
DCHECK_EQ(executable_memory_.find(chunk), executable_memory_.end());
executable_memory_.insert(chunk);
}
void UnregisterExecutableMemoryChunk(MemoryChunk* chunk) {
base::MutexGuard guard(&executable_memory_mutex_);
DCHECK_NE(executable_memory_.find(chunk), executable_memory_.end());
executable_memory_.erase(chunk);
chunk->heap()->UnregisterUnprotectedMemoryChunk(chunk);
......@@ -396,6 +398,7 @@ class MemoryAllocator {
// Data structure to remember allocated executable memory chunks.
std::unordered_set<MemoryChunk*> executable_memory_;
base::Mutex executable_memory_mutex_;
friend class heap::TestCodePageAllocatorScope;
......
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