Changeset 164687 in webkit
- Timestamp:
- Feb 25, 2014, 6:12:57 PM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/JavaScriptCore/ChangeLog ¶
r164683 r164687 1 2014-02-25 Mark Lam <mark.lam@apple.com> 2 3 Web Inspector: CRASH when evaluating in console of JSContext RWI with disabled breakpoints. 4 <https://webkit.org/b/128766> 5 6 Reviewed by Geoffrey Garen. 7 8 Make the JSLock::grabAllLocks() work the same way as for the C loop LLINT. 9 The reasoning is that we don't know of any clients that need unordered 10 re-entry into the VM from different threads. So, we're enforcing ordered 11 re-entry i.e. we must re-grab locks in the reverse order of dropping locks. 12 13 The crash in this bug happened because we were allowing unordered re-entry, 14 and the following type of scenario occurred: 15 16 1. Thread T1 locks the VM, and enters the VM to execute some JS code. 17 2. On entry, T1 detects that VM::m_entryScope is null i.e. this is the 18 first time it entered the VM. 19 T1 sets VM::m_entryScope to T1's entryScope. 20 3. T1 drops all locks. 21 22 4. Thread T2 locks the VM, and enters the VM to execute some JS code. 23 On entry, T2 sees that VM::m_entryScope is NOT null, and therefore 24 does not set the entryScope. 25 5. T2 drops all locks. 26 27 6. T1 re-grabs locks. 28 7. T1 returns all the way out of JS code. On exit from the outer most 29 JS function, T1 clears VM::m_entryScope (because T1 was the one who 30 set it). 31 8. T1 unlocks the VM. 32 33 9. T2 re-grabs locks. 34 10. T2 proceeds to execute some code and expects VM::m_entryScope to be 35 NOT null, but it turns out to be null. Assertion failures and 36 crashes ensue. 37 38 With ordered re-entry, at step 6, T1 will loop and yield until T2 exits 39 the VM. Hence, the issue will no longer manifest. 40 41 * runtime/JSLock.cpp: 42 (JSC::JSLock::dropAllLocks): 43 (JSC::JSLock::grabAllLocks): 44 * runtime/JSLock.h: 45 (JSC::JSLock::DropAllLocks::dropDepth): 46 1 47 2014-02-25 Mark Lam <mark.lam@apple.com> 2 48 -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSLock.cpp ¶
r164683 r164687 27 27 #include "JSObject.h" 28 28 #include "JSCInlines.h" 29 #if ENABLE(LLINT_C_LOOP)30 29 #include <thread> 31 #endif32 30 33 31 namespace JSC { … … 193 191 ++m_lockDropDepth; 194 192 195 UNUSED_PARAM(dropper);196 #if ENABLE(LLINT_C_LOOP)197 193 dropper->setDropDepth(m_lockDropDepth); 198 #endif199 194 200 195 WTFThreadData& threadData = wtfThreadData(); … … 219 214 lock(droppedLockCount); 220 215 221 UNUSED_PARAM(dropper);222 #if ENABLE(LLINT_C_LOOP)223 216 while (dropper->dropDepth() != m_lockDropDepth) { 224 217 unlock(droppedLockCount); … … 226 219 lock(droppedLockCount); 227 220 } 228 #endif229 221 230 222 --m_lockDropDepth; -
TabularUnified trunk/Source/JavaScriptCore/runtime/JSLock.h ¶
r164683 r164687 113 113 JS_EXPORT_PRIVATE ~DropAllLocks(); 114 114 115 #if ENABLE(LLINT_C_LOOP)116 115 void setDropDepth(unsigned depth) { m_dropDepth = depth; } 117 116 unsigned dropDepth() const { return m_dropDepth; } 118 #endif119 117 120 118 private: 121 119 intptr_t m_droppedLockCount; 122 120 RefPtr<VM> m_vm; 123 #if ENABLE(LLINT_C_LOOP)124 121 unsigned m_dropDepth; 125 #endif126 122 }; 127 123
Note:
See TracChangeset
for help on using the changeset viewer.