Changeset 260165 in webkit
- Timestamp:
- Apr 15, 2020 6:40:42 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r260162 r260165 1 2020-04-15 Robin Morisset <rmorisset@apple.com> 2 3 Flaky Test: fetch/fetch-worker-crash.html 4 https://bugs.webkit.org/show_bug.cgi?id=187257 5 <rdar://problem/48527526> 6 7 Reviewed by Yusuke Suzuki. 8 9 The crash is coming from setExceptionPorts which is inlined in WTF::registerThreadForMachExceptionHandling. 10 From the error message we know that the problem is an "invalid port right". 11 http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/thread_set_exception_ports.html tells us that the "port right" is the third parameter to thread_set_exception_ports, which is exceptionPort in our case. 12 exceptionPort is a global variable defined at the top of Signals.cpp: 13 static mach_port_t exceptionPort; 14 It is set in exactly one place: 15 kern_return_t kr = mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &exceptionPort); 16 in a std::call_once, in startMachExceptionHandlerThread(). 17 Note that startMachExceptionHandlerThread() is called from the main thread just before the point where we are stuck.. and there is no synchronization to make sure it completed and its effect is visible to the worker thread before it uses exceptionPort. 18 19 So I think the crash is due to this race between allocating exceptionPort and using it, resulting in an invalid exceptionPort being sometimes passed to the kernel. 20 So this patch is a simple speculative fix, by running startMachExceptionHandlerThread() in initializeThreading(), before JSLock()::lock() can be run. 21 22 * runtime/InitializeThreading.cpp: 23 (JSC::initializeThreading): 24 1 25 2020-04-15 Ross Kirsling <ross.kirsling@sony.com> 2 26 -
trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp
r250725 r260165 54 54 #include <wtf/dtoa.h> 55 55 #include <wtf/dtoa/cached-powers.h> 56 #include <wtf/threads/Signals.h> 56 57 57 58 namespace JSC { … … 100 101 if (VM::isInMiniMode()) 101 102 WTF::fastEnableMiniMode(); 103 104 #if HAVE(MACH_EXCEPTIONS) 105 // JSLock::lock() can call registerThreadForMachExceptionHandling() which crashes if this has not been called first. 106 WTF::startMachExceptionHandlerThread(); 107 #endif 102 108 }); 103 109 } -
trunk/Source/WTF/ChangeLog
r260102 r260165 1 2020-04-15 Robin Morisset <rmorisset@apple.com> 2 3 Flaky Test: fetch/fetch-worker-crash.html 4 https://bugs.webkit.org/show_bug.cgi?id=187257 5 <rdar://problem/48527526> 6 7 Reviewed by Yusuke Suzuki. 8 9 Make startMachExceptionHandlerThread visible so that we can make sure it is called whenever initializing JSC. 10 11 * wtf/threads/Signals.cpp: 12 (WTF::startMachExceptionHandlerThread): 13 * wtf/threads/Signals.h: 14 1 15 2020-04-14 Peng Liu <peng.liu6@apple.com> 2 16 -
trunk/Source/WTF/wtf/threads/Signals.cpp
r241583 r260165 70 70 static constexpr size_t maxMessageSize = 1 * KB; 71 71 72 staticvoid startMachExceptionHandlerThread()72 void startMachExceptionHandlerThread() 73 73 { 74 74 static std::once_flag once; -
trunk/Source/WTF/wtf/threads/Signals.h
r239427 r260165 94 94 class Thread; 95 95 void registerThreadForMachExceptionHandling(Thread&); 96 void startMachExceptionHandlerThread(); 96 97 97 98 void handleSignalsWithMach();
Note: See TracChangeset
for help on using the changeset viewer.