RESOLVED FIXED 232328
Fails to execute JavaScript when soft stack limit is unlimited
https://bugs.webkit.org/show_bug.cgi?id=232328
Summary Fails to execute JavaScript when soft stack limit is unlimited
Michael Catanzaro
Reported 2021-10-26 12:59:27 PDT
Reproducer: $ ulimit -s unlimited $ jsc >>> 1 + 1 Exception: I'm not sure why JSC cannot print the exception, but it's "maximum call stack size exceeded." Problem is since r276695 "[WPE][GTK] More correct fixes for stack size issues on musl libc", 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'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.
Attachments
Patch (1.84 KB, patch)
2021-10-26 14:16 PDT, Michael Catanzaro
no flags
Daniel Kolesa
Comment 1 2021-10-26 13:02:22 PDT
let's have it max out at 8M, realistically there is nothing better you can do i think
Michael Catanzaro
Comment 2 2021-10-26 13:08:41 PDT
Actually I'm not certain it'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) > let's have it max out at 8M, realistically there is nothing better you can > do i think Sounds good.
Michael Catanzaro
Comment 3 2021-10-26 14:14:29 PDT
(In reply to Michael Catanzaro from comment #0) > When the limit is unlimited, > rlim_cur is -1 and the function is not prepared for that. Actually, it is RLIM_INFINITY. Doesn't change the rest of the analysis, though.
Michael Catanzaro
Comment 4 2021-10-26 14:16:08 PDT
Michael Catanzaro
Comment 5 2021-10-26 14:18:39 PDT
(In reply to Michael Catanzaro from comment #2) > Actually I'm not certain it'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. I think it's OK because this returns the real stack size, not the limit. Also, it works fine in practice with no changes to this.
Daniel Kolesa
Comment 6 2021-10-27 04:46:29 PDT
patch lgtm
Radar WebKit Bug Importer
Comment 7 2021-11-02 13:00:26 PDT
Michael Catanzaro
Comment 8 2021-11-02 13:43:41 PDT
Ping reviewers
Yusuke Suzuki
Comment 9 2021-11-02 15:03:23 PDT
Comment on attachment 442530 [details] Patch r=me
EWS
Comment 10 2021-11-02 15:09:33 PDT
Committed r285187 (243816@main): <https://commits.webkit.org/243816@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 442530 [details].
Note You need to log in before you can comment on or make changes to this bug.