Repository navigation
Conversation
|
Updated 1:46 PM PT - Jul 2nd, 2026
❌ @robobun, your commit 3a0ad2f has 1 failures in
🧪 To try this PR locally: bunx bun-pr 30396That installs a local version of the PR into your bun-30396 --bun |
StatusReady to merge. Test-only PR; the source fix already shipped on Reproduced (fail-before), CI build 52790: this fixture, run on this branch before the WebKit bump, failed on every aarch64 lane (darwin-26, darwin-14, debian-13, ubuntu-25.04, alpine-3.23, windows-11) with the exact Pass-after, CI build 68009 (rebased onto Root cause: Yarr JIT CI on build 68009: 285/286 jobs green; no annotation mentions this fixture. The single failure is Reviews: CodeRabbit "no actionable comments", claude-bot "LGTM"; no open review threads. |
5046144 to
708a6f1
Compare
… test
On ARM64, /\B|x{1,2}?/u.exec("a\u{10ffff}b")[0].length returned 4294967295.
The Yarr JIT non-BMP first-character optimization (ARM64-only,
YARR_JIT_UNICODE_CAN_INCREMENT_INDEX_FOR_NON_BMP) advanced matchStart by
firstCharacterAdditionalReadSize in the BodyAlternativeEnd backtrack
trampoline without advancing m_regs.index, so a zero-width first
alternative like \B could return output[0] > output[1] and the match
length underflowed to (unsigned)-1.
Fixed upstream in WebKit 116394de195b (webkit.org/b/312604), pulled into
Bun by the WEBKIT_VERSION bump to d81bcc3d833c in #33133. This adds a
jsc-stress fixture so a future WebKit bump cannot silently regress it;
before the bump every aarch64 CI lane reproduced the underflow.
708a6f1 to
3a0ad2f
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a new Bun/JSC stress test fixture exercising Yarr JIT handling of non-BMP first-character optimization and backtrack trampoline behavior, including a match-boundary validation helper and regression assertions, then registers the fixture in the JS JIT stress test suite's fixture list. ChangesRegression test addition
Sequence Diagram(s)Not applicable — this change is test/fixture-only with no interaction flow to diagram. Estimated code review effort: Medium Suggested labels: test, javascriptcore Suggested reviewers: none identified from provided context Poem A rabbit hops through code so deep, 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
LGTM — test-only addition of a well-documented Yarr JIT regression fixture following the existing jsc-stress pattern.
Extended reasoning...
Overview
This PR adds a single JSC stress test fixture (yarr-non-bmp-backtrack-trampoline-index-sync.js) and registers it in the jsFixtures array of test/js/bun/jsc-stress/jsc-stress.test.ts. The fixture guards against a Yarr JIT bug where /\B|x{1,2}?/u.exec("a\u{10ffff}b")[0].length returned 4294967295 on ARM64 due to a match-start/index desync in the BodyAlternativeEnd backtrack trampoline. The underlying fix already landed via a WebKit bump (#33133); this PR only adds the regression coverage. No src/** changes.
Security risks
None. This is a pure test addition — a fixture file executed only by the test runner in a spawned subprocess, plus a two-line list entry. It touches no runtime, auth, crypto, network, or filesystem code paths.
Level of scrutiny
Low. The change is mechanical and follows the established jsc-stress fixture pattern exactly: a .js fixture in test/js/bun/jsc-stress/fixtures/ that throws on failure, driven by testLoopCount from preload.js (verified present), and registered in the existing jsFixtures list under a new // Yarr JIT comment group. The fixture is self-contained, uses no I/O, and asserts simple invariants (m[0].length <= input.length, m.index + m[0].length <= input.length) that cannot be flaky.
Other factors
The PR description documents CI-verified fail-before (build 52790, all aarch64 lanes hit the 4294967295 underflow) and pass-after on the current WebKit, satisfying the "prove the test fails for the right reason" requirement. The fixture covers multiple pattern shapes (delta==1, delta==2, matching second alternative, /mu disabling the optimization) and includes upstream's own reduction from webkit.org/b/312604. No bugs were found by the bug-hunting system, and there are no prior reviewer comments or outstanding requests on the timeline.
|
Stale PR review: closing. The bug is fixed, and this fixture no longer reaches the code it names. The fix (WebKit/WebKit@116394de195b) reached main with the WebKit upgrade in #32414 (91ce3b4), not with #33133 as the fixture header says. At Bun's current pin (oven-sh/WebKit@299c5323879e), Reopen if this evidence is wrong. |
What
On ARM64 with Bun <= 1.3.14 this prints
4294967295((unsigned)-1). On x86_64 it prints0.Why
The Yarr JIT's non-BMP first-character optimization (
ENABLE_YARR_JIT_UNICODE_CAN_INCREMENT_INDEX_FOR_NON_BMP, ARM64-only) recordsfirstCharacterAdditionalReadSize = 1whenevertryReadUnicodeChardecodes a surrogate pair, so the body-alternative retry loop can step past the whole code point.In the
BodyAlternativeEndbacktrack trampoline, the branch taken whenlastAlternative.minimumSize > firstAlternative.minimumSizesetmatchStart = index + firstCharacterAdditionalReadSizebut jumped tobeginOp->m_reentrywithout applying the same adjustment tom_regs.index. A zero-width first alternative such as\Bcould then succeed at the staleindex, producingoutput[0] > output[1];createRegExpMatchesArraybuilt the whole-match substring with length(unsigned)(end - start) = 4294967295.Fix
Fixed upstream in WebKit while this PR was open: WebKit/WebKit@116394de195b ("[JSC] Yarr JIT \B+unicode+surrogate produces corrupted JSString, crashes WebContent", webkit.org/b/312604) applies the same trampoline change plus a
SetForScopeguard on word-boundary assertion reads.That commit reached this repo through the
WEBKIT_VERSIONbump tod81bcc3d833cin #33133, somainis already fixed. My equivalent source change, oven-sh/WebKit#221, was closed as superseded.This PR
Adds
test/js/bun/jsc-stress/fixtures/yarr-non-bmp-backtrack-trampoline-index-sync.jsso a future WebKit bump cannot silently regress this. The fixture asserts the whole-match substring is always well-formed (length <= input.length,index + length <= input.length) across the pattern shapes that reach this trampoline branch (delta == 1,delta == 2, a matching second alternative,/muwhich disables the optimization), plus upstream's reduction from webkit.org/b/312604.No
src/**change; the source fix arrived via the WebKit dependency.Verification
Fail before (CI build 52790, this branch at
d4c75723on the pre-#33133 WebKit): every aarch64 lane that ranjsc-stress.test.ts(darwin-26, darwin-14, debian-13, ubuntu-25.04, alpine-3.23, windows-11) failed withPass after (rebased onto
main, which carries the fixed WebKitc9ad5813fd):x86_64 never enables the optimization, so the meaningful pass/fail signal is the aarch64 lanes.