[wasm] Fix race in LookupNativeModule method.

R=clemensh@chromium.org
TEST=mjsunit/wasm/data-segments
BUG=v8:7424,v8:8009

Change-Id: I6578b77f69d0d56d7f824486acd4c150e4d20ad0
Reviewed-on: https://chromium-review.googlesource.com/1160224
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54859}
This commit is contained in:
Michael Starzinger 2018-08-02 10:55:49 +02:00 committed by Commit Bot
parent c2ee9c6af7
commit 11d01041b4

View File

@ -965,6 +965,7 @@ WasmCode* WasmCodeManager::GetCodeFromStartAddress(Address pc) const {
}
NativeModule* WasmCodeManager::LookupNativeModule(Address pc) const {
base::LockGuard<base::Mutex> lock(&native_modules_mutex_);
if (lookup_map_.empty()) return nullptr;
auto iter = lookup_map_.upper_bound(pc);