Commit adc6325b authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Fix race when requesting more code memory.

This fixes a race on the {WasmCodeManager::lookup_map} data structure
when requesting more code memory on architectures for which we have the
corresponding {kCanAllocateMoreMemory} flag set. Note that there is no
TSAN coverage for these architectures.

R=clemensh@chromium.org
BUG=chromium:875189

Change-Id: I11a082359b4cb6cc69c3168a956c5152f1dcc833
Reviewed-on: https://chromium-review.googlesource.com/1230136
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55998}
parent 2f01682b
......@@ -661,6 +661,8 @@ Address NativeModule::AllocateForCode(size_t size) {
wasm_code_manager_->TryAllocate(size, reinterpret_cast<void*>(hint)));
VirtualMemory& new_mem = owned_code_space_.back();
if (!new_mem.IsReserved()) return kNullAddress;
base::LockGuard<base::Mutex> lock(
&wasm_code_manager_->native_modules_mutex_);
wasm_code_manager_->AssignRanges(new_mem.address(), new_mem.end(), this);
free_code_space_.Merge({new_mem.address(), new_mem.end()});
......
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