Changeset 199496 in webkit


Ignore:
Timestamp:
Apr 13, 2016 9:10:13 AM (8 years ago)
Author:
mark.lam@apple.com
Message:

ShadowChicken::visitChildren() should not visit tailMarkers and throwMarkers.
https://bugs.webkit.org/show_bug.cgi?id=156532

Reviewed by Saam Barati and Filip Pizlo.

ShadowChicken can store tailMarkers and throwMarkers in its log, specifically in
the callee field of a log packet. However, ShadowChicken::visitChildren()
unconditionally visits the callee field of each packet as if they are real
objects. If visitChildren() encounters one of these markers in the log, we get a
crash.

This crash was observed in the v8-v6/v8-regexp.js stress test running with shadow
chicken when r199393 landed. r199393 introduced tail calls to a RegExp split
fast path, and the v8-regexp.js test exercised this fast path a lot. Throw in
some timely GCs, and we get a crash party.

The fix is to have ShadowChicken::visitChildren() filter out the tailMarker and
throwMarker.

Alternatively, if perf is an issue, we can allocate 2 dedicated objects for
these markers so that ShadowChicken can continue to visit them. For now, I'm
going with the filter.

  • interpreter/ShadowChicken.cpp:

(JSC::ShadowChicken::visitChildren):

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r199459 r199496  
     12016-04-13  Mark Lam  <mark.lam@apple.com>
     2
     3        ShadowChicken::visitChildren() should not visit tailMarkers and throwMarkers.
     4        https://bugs.webkit.org/show_bug.cgi?id=156532
     5
     6        Reviewed by Saam Barati and Filip Pizlo.
     7
     8        ShadowChicken can store tailMarkers and throwMarkers in its log, specifically in
     9        the callee field of a log packet.  However, ShadowChicken::visitChildren()
     10        unconditionally visits the callee field of each packet as if they are real
     11        objects.  If visitChildren() encounters one of these markers in the log, we get a
     12        crash.
     13
     14        This crash was observed in the v8-v6/v8-regexp.js stress test running with shadow
     15        chicken when r199393 landed.  r199393 introduced tail calls to a RegExp split
     16        fast path, and the v8-regexp.js test exercised this fast path a lot.  Throw in
     17        some timely GCs, and we get a crash party.
     18
     19        The fix is to have ShadowChicken::visitChildren() filter out the tailMarker and
     20        throwMarker.
     21
     22        Alternatively, if perf is an issue, we can allocate 2 dedicated objects for
     23        these markers so that ShadowChicken can continue to visit them.  For now, I'm
     24        going with the filter.
     25
     26        * interpreter/ShadowChicken.cpp:
     27        (JSC::ShadowChicken::visitChildren):
     28
    1292016-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
    230
  • trunk/Source/JavaScriptCore/interpreter/ShadowChicken.cpp

    r199076 r199496  
    355355void ShadowChicken::visitChildren(SlotVisitor& visitor)
    356356{
    357     for (unsigned i = m_logCursor - m_log; i--;)
    358         visitor.appendUnbarrieredReadOnlyPointer(m_log[i].callee);
     357    for (unsigned i = m_logCursor - m_log; i--;) {
     358        JSObject* callee = m_log[i].callee;
     359        if (callee != Packet::tailMarker() && callee != Packet::throwMarker())
     360            visitor.appendUnbarrieredReadOnlyPointer(callee);
     361    }
    359362   
    360363    for (Frame& frame : m_stack)
Note: See TracChangeset for help on using the changeset viewer.