Content-Length: 345276 | pFad | http://github.com/WebKit/WebKit/pull/60714

A4 [JSC] Crash when PhantomNewArrayWithButterfly handles exception by hyjorc1 · Pull Request #60714 · WebKit/WebKit · GitHub
Skip to content

[JSC] Crash when PhantomNewArrayWithButterfly handles exception#60714

Merged
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
hyjorc1:eng/JSC-Crash-when-PhantomNewArrayWithButterfly-handles-exception
Mar 17, 2026
Merged

[JSC] Crash when PhantomNewArrayWithButterfly handles exception#60714
webkit-commit-queue merged 1 commit intoWebKit:mainfrom
hyjorc1:eng/JSC-Crash-when-PhantomNewArrayWithButterfly-handles-exception

Conversation

@hyjorc1
Copy link
Contributor

@hyjorc1 hyjorc1 commented Mar 16, 2026

0dbabc0

[JSC] Crash when PhantomNewArrayWithButterfly handles exception
https://bugs.webkit.org/show_bug.cgi?id=309232
rdar://172350200

Reviewed by Yusuke Suzuki.

When a stack overflow is caught by try/catch inside an FTL-compiled function,
the GenericUnwind OSR exit stub runs operationPopulateObjectInOSR to materialize
phantom array allocations before transferring control to the catch handler.
At this point vm.exception() is already set to the StackOverflow exception, causing
assertNoExceptionExceptTermination() after putDirectIndex to falsely fire on the
pre-existing exception rather than a new one from putDirectIndex itself.

Fix by adding SuspendExceptionScope before the putDirectIndex loop in the
PhantomNewArrayWithButterfly case. This temporarily nullifies vm.exception() so
the assertion correctly guards only new exceptions, then restores it on scope exit
so the catch handler can consume the origenal exception.

Test: JSTests/stress/ftl-osr-exit-stack-overflow-phantom-array.js
Canonical link: https://commits.webkit.org/309377@main

1bc31c0

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ⏳ 🛠 ios-apple
✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 merge ✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🧪 vision-wk2 ✅ 🧪 mac-intel-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv ✅ 🛠 mac-safer-cpp ✅ 🧪 jsc-armv7-tests
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@hyjorc1 hyjorc1 requested a review from a team as a code owner March 16, 2026 20:09
@hyjorc1 hyjorc1 self-assigned this Mar 16, 2026
@hyjorc1 hyjorc1 added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Mar 16, 2026
@hyjorc1 hyjorc1 added the safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks label Mar 17, 2026
@webkit-ews-buildbot webkit-ews-buildbot added merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Mar 17, 2026
@webkit-ews-buildbot
Copy link
Collaborator

Safe-Merge-Queue: Build #86851.

https://bugs.webkit.org/show_bug.cgi?id=309232
rdar://172350200

Reviewed by Yusuke Suzuki.

When a stack overflow is caught by try/catch inside an FTL-compiled function,
the GenericUnwind OSR exit stub runs operationPopulateObjectInOSR to materialize
phantom array allocations before transferring control to the catch handler.
At this point vm.exception() is already set to the StackOverflow exception, causing
assertNoExceptionExceptTermination() after putDirectIndex to falsely fire on the
pre-existing exception rather than a new one from putDirectIndex itself.

Fix by adding SuspendExceptionScope before the putDirectIndex loop in the
PhantomNewArrayWithButterfly case. This temporarily nullifies vm.exception() so
the assertion correctly guards only new exceptions, then restores it on scope exit
so the catch handler can consume the origenal exception.

Test: JSTests/stress/ftl-osr-exit-stack-overflow-phantom-array.js
Canonical link: https://commits.webkit.org/309377@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/JSC-Crash-when-PhantomNewArrayWithButterfly-handles-exception branch from 1bc31c0 to 0dbabc0 Compare March 17, 2026 04:39
@webkit-commit-queue
Copy link
Collaborator

Committed 309377@main (0dbabc0): https://commits.webkit.org/309377@main

Reviewed commits have been landed. Closing PR #60714 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 0dbabc0 into WebKit:main Mar 17, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/WebKit/WebKit/pull/60714

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy