<?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>232328</bug_id>
          
          <creation_ts>2021-10-26 12:59:27 -0700</creation_ts>
          <short_desc>Fails to execute JavaScript when soft stack limit is unlimited</short_desc>
          <delta_ts>2021-11-02 15:09:38 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Template Framework</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugzilla.redhat.com/show_bug.cgi?id=2017281</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Michael Catanzaro">mcatanzaro</reporter>
          <assigned_to name="Michael Catanzaro">mcatanzaro</assigned_to>
          <cc>benjamin</cc>
    
    <cc>bugs-noreply</cc>
    
    <cc>cdumez</cc>
    
    <cc>cmarcelo</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>nina</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1808996</commentid>
    <comment_count>0</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-10-26 12:59:27 -0700</bug_when>
    <thetext>Reproducer:

$ ulimit -s unlimited
$ jsc
&gt;&gt;&gt; 1 + 1
Exception:

I&apos;m not sure why JSC cannot print the exception, but it&apos;s &quot;maximum call stack size exceeded.&quot;

Problem is since r276695 &quot;[WPE][GTK] More correct fixes for stack size issues on musl libc&quot;, WTF::StackBounds::currentThreadStackBoundsInternal now calls getrlimit() to get the soft stack limit. When the limit is unlimited, rlim_cur is -1 and the function is not prepared for that. I don&apos;t know how to fix it other than to fall back to some suitable default (8192 seems to be the default soft limit).

This is only a regression on Linux, but the Darwin code has the same bug too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808998</commentid>
    <comment_count>1</comment_count>
    <who name="Nina Kolesová">nina</who>
    <bug_when>2021-10-26 13:02:22 -0700</bug_when>
    <thetext>let&apos;s have it max out at 8M, realistically there is nothing better you can do i think</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1808999</commentid>
    <comment_count>2</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-10-26 13:08:41 -0700</bug_when>
    <thetext>Actually I&apos;m not certain it&apos;s really a regression, because there are preexisting calls to pthread_getattr_np() (or pthread_get_stacksize_np() on Darwin) that would likely have had the same problem.

(In reply to Daniel Kolesa from comment #1)
&gt; let&apos;s have it max out at 8M, realistically there is nothing better you can
&gt; do i think

Sounds good.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1809026</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-10-26 14:14:29 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #0)
&gt; When the limit is unlimited,
&gt; rlim_cur is -1 and the function is not prepared for that.

Actually, it is RLIM_INFINITY. Doesn&apos;t change the rest of the analysis, though.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1809028</commentid>
    <comment_count>4</comment_count>
      <attachid>442530</attachid>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-10-26 14:16:08 -0700</bug_when>
    <thetext>Created attachment 442530
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1809029</commentid>
    <comment_count>5</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-10-26 14:18:39 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #2)
&gt; Actually I&apos;m not certain it&apos;s really a regression, because there are
&gt; preexisting calls to pthread_getattr_np() (or pthread_get_stacksize_np() on
&gt; Darwin) that would likely have had the same problem.

I think it&apos;s OK because this returns the real stack size, not the limit. Also, it works fine in practice with no changes to this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1809222</commentid>
    <comment_count>6</comment_count>
    <who name="Nina Kolesová">nina</who>
    <bug_when>2021-10-27 04:46:29 -0700</bug_when>
    <thetext>patch lgtm</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1811232</commentid>
    <comment_count>7</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-11-02 13:00:26 -0700</bug_when>
    <thetext>&lt;rdar://problem/84943302&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1811248</commentid>
    <comment_count>8</comment_count>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2021-11-02 13:43:41 -0700</bug_when>
    <thetext>Ping reviewers</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1811285</commentid>
    <comment_count>9</comment_count>
      <attachid>442530</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2021-11-02 15:03:23 -0700</bug_when>
    <thetext>Comment on attachment 442530
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1811287</commentid>
    <comment_count>10</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-11-02 15:09:33 -0700</bug_when>
    <thetext>Committed r285187 (243816@main): &lt;https://commits.webkit.org/243816@main&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 442530.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>442530</attachid>
            <date>2021-10-26 14:16:08 -0700</date>
            <delta_ts>2021-11-02 15:09:35 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-232328-20211026161608.patch</filename>
            <type>text/plain</type>
            <size>1883</size>
            <attacher name="Michael Catanzaro">mcatanzaro</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjg0ODkxCmRpZmYgLS1naXQgYS9Tb3VyY2UvV1RGL0NoYW5n
ZUxvZyBiL1NvdXJjZS9XVEYvQ2hhbmdlTG9nCmluZGV4IDE0MDYzZDcyYTE5ZGZjNTlhODMxZTM4
YTgxOTk3NGUxNjQ0NDc2MTAuLmI2NmFjNzBiNjk3YzQzMGEyMDA5YTg2M2QwYjIxYTdmZjYzNDEy
N2YgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XVEYvQ2hhbmdlTG9nCisrKyBiL1NvdXJjZS9XVEYvQ2hh
bmdlTG9nCkBAIC0xLDMgKzEsMTYgQEAKKzIwMjEtMTAtMjYgIE1pY2hhZWwgQ2F0YW56YXJvICA8
bWNhdGFuemFyb0Bnbm9tZS5vcmc+CisKKyAgICAgICAgRmFpbHMgdG8gZXhlY3V0ZSBKYXZhU2Ny
aXB0IHdoZW4gc29mdCBzdGFjayBsaW1pdCBpcyB1bmxpbWl0ZWQKKyAgICAgICAgaHR0cHM6Ly9i
dWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTIzMjMyOAorCisgICAgICAgIFJldmlld2Vk
IGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIEZhbGwgYmFjayB0byBhc3N1bWluZyBhbiA4
IE1CIHN0YWNrIGxpbWl0IHdoZW4gdGhlIHJlYWwgbGltaXQgaXMgdW5saW1pdGVkLiBKU0MgbmVl
ZHMgdG8KKyAgICAgICAgaGF2ZSBzb21lIG1heGltdW0gc3RhY2sgc2l6ZSB0byB3b3JrIHdpdGgs
IGFuZCB0aGlzIGlzIGFzIGdvb2QgY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CBib3VuZCB9OwogICAgIH0KQEAg
LTEyNSw2ICsxMjcsOCBAQCBTdGFja0JvdW5kcyBTdGFja0JvdW5kczo6Y3VycmVudFRocmVhZFN0
YWNrQm91bmRzSW50ZXJuYWwoKQogICAgICAgICBybGltaXQgbGltaXQ7CiAgICAgICAgIGdldHJs
aW1pdChSTElNSVRfU1RBQ0ssICZsaW1pdCk7CiAgICAgICAgIHJsaW1fdCBzaXplID0gbGltaXQu
cmxpbV9jdXI7CisgICAgICAgIGlmIChzaXplID09IFJMSU1fSU5GSU5JVFkpCisgICAgICAgICAg
ICBzaXplID0gOCAqIE1COwogICAgICAgICAvLyBhY2NvdW50IGZvciBhIGd1YXJkIHBhZ2UKICAg
ICAgICAgc2l6ZSAtPSBzdGF0aWNfY2FzdDxybGltX3Q+KHN5c2NvbmYoX1NDX1BBR0VTSVpFKSk7
CiAgICAgICAgIHZvaWQqIGJvdW5kID0gc3RhdGljX2Nhc3Q8Y2hhcio+KG9yaWdpbikgLSBzaXpl
Owo=
</data>

          </attachment>
      

    </bug>

</bugzilla>