Changeset 232983 in webkit


Ignore:
Timestamp:
Jun 19, 2018 2:27:05 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

ShadowChicken crashes with stack overflow in the LLInt
https://bugs.webkit.org/show_bug.cgi?id=186540
<rdar://problem/39682133>

Patch by Tadeu Zagallo <Tadeu Zagallo> on 2018-06-19
Reviewed by Saam Barati.

JSTests:

Add test that stack overflows and crashes on ShadowChicken when JIT is
disabled and forceDebuggerBytecodeGeneration is enabled.

  • stress/llint-stack-overflow-debugging-opcodes.js: Added.

(foo):
(catch):

Source/JavaScriptCore:

Stack overflows in the LLInt were crashing in ShadowChicken when compiling
with debug opcodes because it was accessing the scope of the incomplete top
frame, which hadn't been set yet. Check that we have moved past the first
opcode (enter) and that the scope is not undefined (enter will
initialize it to undefined).

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::update):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r232971 r232983  
     12018-06-19  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        ShadowChicken crashes with stack overflow in the LLInt
     4        https://bugs.webkit.org/show_bug.cgi?id=186540
     5        <rdar://problem/39682133>
     6
     7        Reviewed by Saam Barati.
     8
     9        Add test that stack overflows and crashes on ShadowChicken when JIT is
     10        disabled and forceDebuggerBytecodeGeneration is enabled.
     11
     12        * stress/llint-stack-overflow-debugging-opcodes.js: Added.
     13        (foo):
     14        (catch):
     15
    1162018-06-19  Leo Balter  <leonardo.balter@gmail.com>
    217
  • trunk/Source/JavaScriptCore/ChangeLog

    r232977 r232983  
     12018-06-19  Tadeu Zagallo  <tzagallo@apple.com>
     2
     3        ShadowChicken crashes with stack overflow in the LLInt
     4        https://bugs.webkit.org/show_bug.cgi?id=186540
     5        <rdar://problem/39682133>
     6
     7        Reviewed by Saam Barati.
     8
     9        Stack overflows in the LLInt were crashing in ShadowChicken when compiling
     10        with debug opcodes because it was accessing the scope of the incomplete top
     11        frame, which hadn't been set yet. Check that we have moved past the first
     12        opcode (enter) and that the scope is not undefined (enter will
     13        initialize it to undefined).
     14
     15        * interpreter/ShadowChicken.cpp:
     16        (JSC::ShadowChicken::update):
     17
    1182018-06-19  Keith Miller  <keith_miller@apple.com>
    219
  • trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp

    r229410 r232983  
    301301            JSScope* scope = nullptr;
    302302            CodeBlock* codeBlock = callFrame->codeBlock();
    303             if (codeBlock && codeBlock->wasCompiledWithDebuggingOpcodes() && codeBlock->scopeRegister().isValid()) {
    304                 scope = callFrame->scope(codeBlock->scopeRegister().offset());
     303            JSValue scopeValue = callFrame->bytecodeOffset() && codeBlock && codeBlock->scopeRegister().isValid()
     304                ? callFrame->registers()[codeBlock->scopeRegister().offset()].jsValue()
     305                : jsUndefined();
     306            if (!scopeValue.isUndefined() && codeBlock->wasCompiledWithDebuggingOpcodes()) {
     307                scope = jsCast<JSScope*>(scopeValue.asCell());
    305308                RELEASE_ASSERT(scope->inherits<JSScope>(vm));
    306309            } else if (foundFrame) {
Note: See TracChangeset for help on using the changeset viewer.