<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>125928</bug_id>
          
          <creation_ts>2013-12-18 08:42:01 -0800</creation_ts>
          <short_desc>CStack: Fix stack checking and stack overflow handling</short_desc>
          <delta_ts>2014-01-13 17:13:45 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>ASSIGNED</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>126007</dependson>
    
    <dependson>126009</dependson>
    
    <dependson>126036</dependson>
    
    <dependson>126088</dependson>
    
    <dependson>126109</dependson>
    
    <dependson>126139</dependson>
    
    <dependson>126140</dependson>
    
    <dependson>126320</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Mark Lam">mark.lam</reporter>
          <assigned_to name="Mark Lam">mark.lam</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>mhahnenberg</cc>
    
    <cc>msaboff</cc>
    
    <cc>oliver</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>960947</commentid>
    <comment_count>0</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2013-12-18 08:42:01 -0800</bug_when>
    <thetext>operationStackCheck() (in JITOpereations.cpp) should not be testing the JSStack for overflow.  operationStackCheck() is only called when an overflow has been detected by JITted code.  Since the C stack is not growable, there&apos;s no need to repeat the stack check before throwing a StackOverflowError.

Running a small test (the attached test-eval.js), I see that the LLINT failed to detect a stack overflow and crashed after exhausting the stack.  The baseline JIT and DFG fared better in detecting the overflow (with the above stack check in operationStackCheck() commented out), but fails to unwind the stack during handling of the StackOverflowError.  They ended up in an infinite loop during the unwind.

All of these need to be fixed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>960948</commentid>
    <comment_count>1</comment_count>
      <attachid>219540</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2013-12-18 08:42:43 -0800</bug_when>
    <thetext>Created attachment 219540
a stack overflow test</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>961298</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2013-12-18 23:54:51 -0800</bug_when>
    <thetext>Also need to search for all places that uses JSStack::grow() to do a stack check.  These should either removed or #if ENABLE(LLINT_C_LOOP).  In their place, we should be doing a limit check on the C stack.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>961398</commentid>
    <comment_count>3</comment_count>
    <who name="Oliver Hunt">oliver</who>
    <bug_when>2013-12-19 08:49:01 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Also need to search for all places that uses JSStack::grow() to do a stack check.  These should either removed or #if ENABLE(LLINT_C_LOOP).  In their place, we should be doing a limit check on the C stack.

Does JSStack::grow() ever make sense when using the stack? Assuming it doesn&apos;t we should just put #if ENABLE(LLINT_C_LOOP) around the definition and declaration.  That would instantly make it impossible to use it accidetanly</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>967567</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2014-01-13 17:13:45 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Does JSStack::grow() ever make sense when using the stack? Assuming it doesn&apos;t we should just put #if ENABLE(LLINT_C_LOOP) around the definition and declaration.  That would instantly make it impossible to use it accidetanly

FYI, JSStack::grow() was moved into a ENABLE(LLINT_C_LOOP) only section in r160982 &lt;http://trac.webkit.org/r160982&gt; which was landed for https://bugs.webkit.org/show_bug.cgi?id=126140.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>219540</attachid>
            <date>2013-12-18 08:42:43 -0800</date>
            <delta_ts>2013-12-18 08:42:43 -0800</delta_ts>
            <desc>a stack overflow test </desc>
            <filename>test-eval.js</filename>
            <type>application/x-javascript</type>
            <size>118</size>
            <attacher name="Mark Lam">mark.lam</attacher>
            
              <data encoding="base64">CnZhciBzcmMgPSAicHJpbnQoJ0luIGV2YWw6Jyk7XG4iICsKIiAgICBmdW5jdGlvbiBhKCkge1xu
IiArCiIgICAgICAgIGEoKTtcbiIgKwoiICAgIH1cbiIgKwoiICAgIGEoKTtcbiIKOwpldmFsKHNy
Yyk7Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>