WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
64465
Possible race condition in ThreadIdentifierData::initializeKeyOnce and shouldCallRealDebugger.
https://bugs.webkit.org/show_bug.cgi?id=64465
Summary
Possible race condition in ThreadIdentifierData::initializeKeyOnce and should...
David Levin
Reported
2011-07-13 10:41:57 PDT
The race condition is highly unlikely and was only noticed through code inspection but it is trivial to make the code correct. The race would happen if the static initialization starts to happen on two threads. Thread 1 does the initialization and Thread 2 is at the initialization code but hasn't yet executed it. Thread 1 finishes the pthread_once call and then Thread 2 initializes onceControl to PTHREAD_ONCE_INIT. Thread 2 does the pthread_once call which happens again now.
Attachments
Patch
(3.97 KB, patch)
2011-07-13 11:03 PDT
,
David Levin
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
David Levin
Comment 1
2011-07-13 10:52:20 PDT
All other instances do this correctly now. Source/JavaScriptCore/runtime/JSLock.cpp:pthread_once_t createJSLockCountOnce = PTHREAD_ONCE_INIT; Source/JavaScriptCore/wtf/FastMalloc.cpp:static pthread_once_t isForbiddenKeyOnce = PTHREAD_ONCE_INIT; Source/JavaScriptCore/wtf/MainThread.cpp:static pthread_once_t initializeMainThreadKeyOnce = PTHREAD_ONCE_INIT; Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp:static pthread_once_t onceControl = PTHREAD_ONCE_INIT; Source/JavaScriptGlue/JSUtils.cpp:static pthread_once_t globalObjectKeyOnce = PTHREAD_ONCE_INIT; Source/WebCore/bridge/jni/jni_jsobject.mm:static pthread_once_t javaScriptAccessLockOnce = PTHREAD_ONCE_INIT; Source/WebKit/mac/Misc/WebKitErrors.m:static pthread_once_t registerErrorsControl = PTHREAD_ONCE_INIT; Source/WebKit/mac/Misc/WebKitSystemBits.m:static pthread_once_t initControl = PTHREAD_ONCE_INIT; Source/WebKit/mac/Misc/WebNSURLExtras.mm:static pthread_once_t IDNScriptWhiteListFileRead = PTHREAD_ONCE_INIT; Source/WebKit2/WebProcess/WebCoreSupport/mac/WebErrorsMac.mm:static pthread_once_t registerErrorsControl = PTHREAD_ONCE_INIT;
David Levin
Comment 2
2011-07-13 11:03:31 PDT
Created
attachment 100687
[details]
Patch
Dmitry Titov
Comment 3
2011-07-13 11:43:12 PDT
Comment on
attachment 100687
[details]
Patch Nice.
WebKit Review Bot
Comment 4
2011-07-13 12:19:38 PDT
Comment on
attachment 100687
[details]
Patch Clearing flags on attachment: 100687 Committed
r90939
: <
http://trac.webkit.org/changeset/90939
>
WebKit Review Bot
Comment 5
2011-07-13 12:19:42 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug