Changeset 245646 in webkit


Ignore:
Timestamp:
May 22, 2019 2:03:20 PM (5 years ago)
Author:
Tadeu Zagallo
Message:

Fix validateExceptionChecks for CLoop
https://bugs.webkit.org/show_bug.cgi?id=191253

Reviewed by Keith Miller.

validateExceptionChecks relies on the stack position to determine if
an ExceptionScope was going to be handled by LLInt or JIT, but when
running with CLoop, it was comparing VM::topEntryFrame, which was an
address inside the CLoopStack to machine stack. This caused exceptions
to never be checked on x86 and always fail on ARM.

  • runtime/CatchScope.h:
  • runtime/ExceptionScope.h:
  • runtime/ThrowScope.h:
  • runtime/VM.cpp:

(JSC::VM::currentCLoopStackPointer const):

  • runtime/VM.h:
Location:
trunk/Source/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r245645 r245646  
     12019-05-22 Zagallo  <tzagallo@apple.com>
     2
     3        Fix validateExceptionChecks for CLoop
     4        https://bugs.webkit.org/show_bug.cgi?id=191253
     5
     6        Reviewed by Keith Miller.
     7
     8        validateExceptionChecks relies on the stack position to determine if
     9        an ExceptionScope was going to be handled by LLInt or JIT, but when
     10        running with CLoop, it was comparing VM::topEntryFrame, which was an
     11        address inside the CLoopStack to machine stack. This caused exceptions
     12        to never be checked on x86 and always fail on ARM.
     13
     14        * runtime/CatchScope.h:
     15        * runtime/ExceptionScope.h:
     16        * runtime/ThrowScope.h:
     17        * runtime/VM.cpp:
     18        (JSC::VM::currentCLoopStackPointer const):
     19        * runtime/VM.h:
     20
    1212019-05-22  Tadeu Zagallo  <tzagallo@apple.com>
    222
  • trunk/Source/JavaScriptCore/runtime/CatchScope.h

    r237042 r245646  
    4949
    5050#define DECLARE_CATCH_SCOPE(vm__) \
    51     JSC::CatchScope((vm__), JSC::ExceptionEventLocation(EXCEPTION_SCOPE_POSITION_FOR_ASAN, __FUNCTION__, __FILE__, __LINE__))
     51    JSC::CatchScope((vm__), JSC::ExceptionEventLocation(EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__), __FUNCTION__, __FILE__, __LINE__))
    5252
    5353#else // not ENABLE(EXCEPTION_SCOPE_VERIFICATION)
  • trunk/Source/JavaScriptCore/runtime/ExceptionScope.h

    r237042 r245646  
    3939#define EXCEPTION_ASSERT_WITH_MESSAGE(assertion, message) RELEASE_ASSERT_WITH_MESSAGE(assertion, message)
    4040
    41 #if ASAN_ENABLED && COMPILER(GCC_COMPATIBLE)
    42 #define EXCEPTION_SCOPE_POSITION_FOR_ASAN currentStackPointer()
     41#if ENABLE(C_LOOP)
     42#define EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__) (vm__).currentCLoopStackPointer()
     43#elif ASAN_ENABLED && COMPILER(GCC_COMPATIBLE)
     44#define EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__) currentStackPointer()
    4345#else
    44 #define EXCEPTION_SCOPE_POSITION_FOR_ASAN nullptr
     46#define EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__) nullptr
    4547#endif
    4648
     
    5456    ALWAYS_INLINE void releaseAssertNoException() { RELEASE_ASSERT_WITH_MESSAGE(!exception(), "%s", unexpectedExceptionMessage().data()); }
    5557
    56 #if ASAN_ENABLED
     58#if ASAN_ENABLED || ENABLE(C_LOOP)
    5759    const void* stackPosition() const {  return m_location.stackPosition; }
    5860#else
  • trunk/Source/JavaScriptCore/runtime/ThrowScope.h

    r242596 r245646  
    6363
    6464#define DECLARE_THROW_SCOPE(vm__) \
    65     JSC::ThrowScope((vm__), JSC::ExceptionEventLocation(EXCEPTION_SCOPE_POSITION_FOR_ASAN, __FUNCTION__, __FILE__, __LINE__))
     65    JSC::ThrowScope((vm__), JSC::ExceptionEventLocation(EXCEPTION_SCOPE_POSITION_FOR_ASAN(vm__), __FUNCTION__, __FILE__, __LINE__))
    6666
    6767#define throwScopePrintIfNeedCheck(scope__) \
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r244764 r245646  
    11491149    return interpreter->cloopStack().isSafeToRecurse();
    11501150}
     1151
     1152void* VM::currentCLoopStackPointer() const
     1153{
     1154    return interpreter->cloopStack().currentStackPointer();
     1155}
    11511156#endif // ENABLE(C_LOOP)
    11521157
  • trunk/Source/JavaScriptCore/runtime/VM.h

    r245586 r245646  
    731731    void* cloopStackLimit() { return m_cloopStackLimit; }
    732732    void setCLoopStackLimit(void* limit) { m_cloopStackLimit = limit; }
     733    JS_EXPORT_PRIVATE void* currentCLoopStackPointer() const;
    733734#endif
    734735
Note: See TracChangeset for help on using the changeset viewer.