[JSC] FunctionOverrides should have a lock to ensure concurrent access to hash table...
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Sep 2019 02:52:46 +0000 (02:52 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 5 Sep 2019 02:52:46 +0000 (02:52 +0000)
commited8fd9aa02e47ae127c48b39c3b725c258442307
tree1c385cb99195784d03da2ff798a32ac6e171e2ed
parent6e9a9baf8ff05a8a88c47db021613f666998cbca
[JSC] FunctionOverrides should have a lock to ensure concurrent access to hash table does not happen
https://bugs.webkit.org/show_bug.cgi?id=201485

Reviewed by Tadeu Zagallo.

FunctionOverrides is a per-process singleton for registering overrides information. But we are accessing
it without taking a lock. If multiple threads with multiple VMs are accessing this concurrently, we have
a race issue like,

1. While one thread is adding overrides information,
2. Another thread is accessing this hash table.

This patch adds a lock to make sure that only one thread can access this registry.

* tools/FunctionOverrides.cpp:
(JSC::FunctionOverrides::FunctionOverrides):
(JSC::FunctionOverrides::reinstallOverrides):
(JSC::FunctionOverrides::initializeOverrideFor):
(JSC::FunctionOverrides::parseOverridesInFile):
* tools/FunctionOverrides.h:
(JSC::FunctionOverrides::clear):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/tools/FunctionOverrides.cpp
Source/JavaScriptCore/tools/FunctionOverrides.h