Possible race condition in ThreadIdentifierData::initializeKeyOnce and shouldCallReal...
authorlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jul 2011 19:19:23 +0000 (19:19 +0000)
committerlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Jul 2011 19:19:23 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=64465

Reviewed by Dmitry Titov.

There isn't a good way to test this as it is very highly unlikely to occur.

Source/JavaScriptCore:

* wtf/ThreadIdentifierDataPthreads.cpp:
(WTF::ThreadIdentifierData::initializeKeyOnce): Since scoped static initialization
isn't thread-safe, change the initialization to be global.

Source/WebKit2:

* PluginProcess/mac/PluginProcessMac.mm:
(WebKit::shouldCallRealDebugger): :Since scoped static initialization
isn't thread-safe, change the initialization to be global.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@90939 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/wtf/ThreadIdentifierDataPthreads.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/PluginProcess/mac/PluginProcessMac.mm

index db224871ab1568e2f74182bb2f8c16cb39251165..dfaf41a74151485debc8155a3be7ed4983d5c378 100644 (file)
@@ -1,3 +1,16 @@
+2011-07-13  David Levin  <levin@chromium.org>
+
+        Possible race condition in ThreadIdentifierData::initializeKeyOnce and shouldCallRealDebugger.
+        https://bugs.webkit.org/show_bug.cgi?id=64465
+
+        Reviewed by Dmitry Titov.
+
+        There isn't a good way to test this as it is very highly unlikely to occur.
+
+        * wtf/ThreadIdentifierDataPthreads.cpp:
+        (WTF::ThreadIdentifierData::initializeKeyOnce): Since scoped static initialization
+        isn't thread-safe, change the initialization to be global.
+
 2011-07-12  Gavin Barraclough  <barraclough@apple.com>
 
         https://bugs.webkit.org/show_bug.cgi?id=64424
index 042d49e9fc6dab99585085b0eeee35c47b0d31bf..dcbc96ffc44b03260a577f2d9559eacfdfc34324 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 Google Inc. All rights reserved.
+ * Copyright (C) 2009, 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -39,6 +39,7 @@
 namespace WTF {
 
 pthread_key_t ThreadIdentifierData::m_key;
+static pthread_once_t onceControl = PTHREAD_ONCE_INIT;
 
 void clearPthreadHandleForIdentifier(ThreadIdentifier);
 
@@ -86,7 +87,6 @@ void ThreadIdentifierData::initializeKeyOnceHelper()
 
 void ThreadIdentifierData::initializeKeyOnce()
 {
-    static pthread_once_t onceControl = PTHREAD_ONCE_INIT;
     if (pthread_once(&onceControl, initializeKeyOnceHelper))
         CRASH();
 }
index 40055984d7ca342e2355098b9805a537dd8bd04f..fe6fcad11de2669338dd776beab547f86a083184 100644 (file)
@@ -1,3 +1,16 @@
+2011-07-13  David Levin  <levin@chromium.org>
+
+        Possible race condition in ThreadIdentifierData::initializeKeyOnce and shouldCallRealDebugger.
+        https://bugs.webkit.org/show_bug.cgi?id=64465
+
+        Reviewed by Dmitry Titov.
+
+        There isn't a good way to test this as it is very highly unlikely to occur.
+
+        * PluginProcess/mac/PluginProcessMac.mm:
+        (WebKit::shouldCallRealDebugger): :Since scoped static initialization
+        isn't thread-safe, change the initialization to be global.
+
 2011-07-13  Andreas Kling  <kling@webkit.org>
 
         [Qt][WK2] Remove invalid signal/slot connection in QTouchWebView.
index 101b79aaa3e142534661fa8bc695cb38a94fe6cd..fab921e75140bb83741ee0a4bffea32322081328 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,6 +40,8 @@
 
 namespace WebKit {
 
+static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT;
+
 class FullscreenWindowTracker {
     WTF_MAKE_NONCOPYABLE(FullscreenWindowTracker);
 
@@ -132,7 +135,6 @@ static void initShouldCallRealDebugger()
 
 static bool shouldCallRealDebugger()
 {
-    static pthread_once_t shouldCallRealDebuggerOnce = PTHREAD_ONCE_INIT;
     pthread_once(&shouldCallRealDebuggerOnce, initShouldCallRealDebugger);
     
     return isUserbreakSet;