Changeset 33438 in webkit


Ignore:
Timestamp:
May 14, 2008 5:14:56 AM (16 years ago)
Author:
oliver@apple.com
Message:

Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
<https://bugs.webkit.org/show_bug.cgi?id=19024>

Reviewed by Maciej

This fixes a number of issues. The most important is that we now check every register
file for tainting rather than just looking for function register files as that was
insufficient. Additionally guarded against implicit re-entry into Eval code.

Also added a few additional assertions to reduce the amout of time between something
going wrong and us seeing the error.

Location:
branches/squirrelfish
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/squirrelfish/JavaScriptCore/ChangeLog

    r33437 r33438  
     12008-05-14  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
     6        <https://bugs.webkit.org/show_bug.cgi?id=19024>
     7
     8        This fixes a number of issues.  The most important is that we now check every register
     9        file for tainting rather than just looking for function register files as that was
     10        insufficient. Additionally guarded against implicit re-entry into Eval code.
     11
     12        Also added a few additional assertions to reduce the amout of time between something
     13        going wrong and us seeing the error.
     14
     15        * VM/Machine.cpp:
     16        (KJS::Machine::execute):
     17        (KJS::Machine::privateExecute):
     18        * VM/RegisterFile.cpp:
     19        (KJS::RegisterFile::growBuffer):
     20        (KJS::RegisterFile::addGlobalSlots):
     21        * VM/RegisterFileStack.cpp:
     22        (KJS::RegisterFileStack::pushGlobalRegisterFile):
     23        (KJS::RegisterFileStack::pushFunctionRegisterFile):
     24        * VM/RegisterFileStack.h:
     25        (KJS::RegisterFileStack::inImplicitCall):
     26
    1272008-05-14  Geoffrey Garen  <ggaren@apple.com>
    228
  • branches/squirrelfish/JavaScriptCore/VM/Machine.cpp

    r33437 r33438  
    724724{
    725725    RegisterFile* registerFile = registerFileStack->current();
    726     return Machine::execute(evalNode, exec, thisObj, registerFile, registerFile->size(), scopeChain, exception);
     726    if (registerFile->safeForReentry())
     727        return Machine::execute(evalNode, exec, thisObj, registerFile, registerFile->size(), scopeChain, exception);
     728    registerFile = registerFileStack->pushFunctionRegisterFile();
     729    JSValue* result = Machine::execute(evalNode, exec, thisObj, registerFile, registerFile->size(), scopeChain, exception);
     730    registerFileStack->popFunctionRegisterFile();
     731    return result;
    727732}
    728733
     
    14221427        int base = (++vPC)->u.operand;
    14231428        int property = (++vPC)->u.operand;
    1424 
     1429#ifndef NDEBUG
     1430        int registerOffset = r - (*registerBase);
     1431#endif
    14251432        JSObject* baseObj = r[base].u.jsValue->toObject(exec);
    14261433
    14271434        Identifier& ident = codeBlock->identifiers[property];
    14281435        JSValue *result = baseObj->get(exec, ident);
     1436        ASSERT(registerOffset == (r - (*registerBase)));
    14291437        VM_CHECK_EXCEPTION();
    14301438        r[dst].u.jsValue = result;
     
    14441452        int property = (++vPC)->u.operand;
    14451453        int value = (++vPC)->u.operand;
     1454#ifndef NDEBUG
     1455        int registerOffset = r - (*registerBase);
     1456#endif
    14461457
    14471458        JSObject* baseObj = r[base].u.jsValue->toObject(exec);
     
    14491460        Identifier& ident = codeBlock->identifiers[property];
    14501461        baseObj->put(exec, ident, r[value].u.jsValue);
     1462        ASSERT(registerOffset == (r - (*registerBase)));
    14511463       
    14521464        VM_CHECK_EXCEPTION();
  • branches/squirrelfish/JavaScriptCore/VM/RegisterFile.cpp

    r33327 r33438  
    5353    if (minCapacity > m_maxSize)
    5454        return false;
     55
    5556    size_t numGlobalSlots = this->numGlobalSlots();
    5657    size_t size = m_size + numGlobalSlots;
     
    6970    if (!count)
    7071        return;
    71 
     72    ASSERT(safeForReentry());
    7273    size_t numGlobalSlots = this->numGlobalSlots();
    7374    size_t size = m_size + numGlobalSlots;
  • branches/squirrelfish/JavaScriptCore/VM/RegisterFileStack.cpp

    r33371 r33438  
    4545
    4646    // Common case: Existing register file is not in use: re-use it.
    47     if (!current->size())
     47    if (!current->size()) {
     48        current->setSafeForReentry(true);
    4849        return current;
     50    }
    4951
    5052    // Slow case: Existing register file is in use: Create a nested
     
    8789RegisterFile* RegisterFileStack::pushFunctionRegisterFile()
    8890{
    89     m_functionStackDepth++;
    9091    return allocateRegisterFile(current()->maxSize() - current()->size());
    9192}
     
    9394void RegisterFileStack::popFunctionRegisterFile()
    9495{
    95     m_functionStackDepth--;
    9696    delete m_stack.last();
    9797    m_stack.removeLast();
  • branches/squirrelfish/JavaScriptCore/VM/RegisterFileStack.h

    r33371 r33438  
    3939        RegisterFileStack()
    4040            : m_globalBase(0)
    41             , m_functionStackDepth(0)
    4241        {
    4342            allocateRegisterFile(RegisterFile::DefaultRegisterFileSize, this);
     
    7069        }
    7170
    72         bool inImplicitCall() { return m_functionStackDepth > 0; }
     71        bool inImplicitCall() {
     72            for (size_t i = 0; i < m_stack.size(); ++i) {
     73                if (!m_stack[i]->safeForReentry())
     74                    return true;
     75            }
     76            return false;
     77        }
     78
    7379    private:
    7480        typedef Vector<RegisterFile*, 4> Stack;
     
    9197        Stack m_stack;
    9298        Register* m_globalBase;
    93         int m_functionStackDepth;
    9499    };
    95100
  • branches/squirrelfish/LayoutTests/ChangeLog

    r33436 r33438  
     12008-05-14  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Maciej.
     4
     5        Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
     6        <https://bugs.webkit.org/show_bug.cgi?id=19024>
     7
     8        Make sure we handled tainted global RegisterFiles properly.
     9
     10        * fast/js/implicit-global-to-global-reentry-expected.txt: Added.
     11        * fast/js/implicit-global-to-global-reentry.html: Added.
     12
    1132008-05-14  Oliver Hunt  <oliver@apple.com>
    214
Note: See TracChangeset for help on using the changeset viewer.