Skip to content

Bump WebKit: Windows GC conservative-scan hardening (preview) - #36772

Draft
robobun wants to merge 1 commit into
mainfrom
farm/c9105e62/webkit-win-gc-hardening
Draft

Bump WebKit: Windows GC conservative-scan hardening (preview)#36772
robobun wants to merge 1 commit into
mainfrom
farm/c9105e62/webkit-win-gc-hardening

Conversation

@robobun

@robobun robobun commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

Bumps WebKit to oven-sh/WebKit#382 (autobuild-preview-pr-382-87d87c14) to exercise the Windows GC conservative-scan hardening in Bun's CI.

Changes picked up (four commits in the WebKit PR):

  1. Thread::getRegisters (Windows): RELEASE_ASSERT on GetThreadContext failure (with GetLastError() in crash info) and return only the populated CONTEXT_INTEGER | CONTEXT_CONTROL prefix (256 bytes on x64 vs sizeof(CONTEXT) = 1232) so the conservative root scan does not copy uninitialized collector stack.
  2. MachineThreads::tryCopyOtherThreadStack: value-initialize PlatformRegisters so unpopulated bytes scan as zero, not stale SlotVisitor frames. Platform-independent.
  3. Thread::suspend (Windows): retry both SuspendThread and GetThreadContext with spin-then-Sleep(1) backoff (up to 100 attempts) for transient failures. tryCopyOtherThreadStacks: RELEASE_ASSERT if a live thread still cannot be suspended instead of silently skipping its roots. (A thread that has completed didExit() is already removed from the group under the lock we hold, so there is no exited-thread case to tolerate.)
  4. RegisterState.h: gate the explicit callee-save inline-asm capture on COMPILER(GCC_COMPATIBLE) || COMPILER(CLANG) (clang-cl defines __clang__ but not __GNUC__, and accepts GNU inline asm) and add a Win64 variant capturing rbx, rbp, rdi, rsi, r12-r15. Also adds rbp to the SysV x86_64 list. MSVC proper keeps the setjmp fallback.

Also pulls in the intervening WebKit main commits 34c01d13..9f8f24db (shorthand-in-arrow arguments capture fix, CodeBlock-aging gating off by default, Dockerfile.windows CI fixes).

Do not merge until oven-sh/WebKit#382 lands on main; then re-point WEBKIT_VERSION at the merged sha.


no test proof · iteration 1 · build/CI scripts only; test-proof not applicable

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Found 11 issues this PR may fix:

  1. Segfault in JSC thread suspension on 1.3.14 when started via docker exec (fine as main process) - regression since 1.3.11 #31832 - Crash output explicitly contains "embedder failed to suspend thread"; directly addressed by Thread::suspend retry/RELEASE_ASSERT fix
  2. Segfault at 0xD0 in JSC GC parallel marking (SlotVisitor::visitChildren) — Bun 1.3.14, Linux arm64, long-running HTTP server #34476 - Segfault in SlotVisitor::visitChildren during GC parallel marking; matches platform-independent MachineThreads::tryCopyOtherThreadStack value-initialization fix
  3. Flaky SIGILL crash in JSC garbage collector during bun test on Linux x64 (1.3.7 and 1.3.9) #27312 - Flaky SIGILL in SlotVisitor::drainHeap::runFixpointPhase during GC; stack trace is in the exact GC marking path fixed by PlatformRegisters value-initialization
  4. Random crash #20429 - FPE in JSC::JSString::visitChildrenSlotVisitor::drain; explicit GC SlotVisitor stack matches PlatformRegisters value-initialization fix
  5. Segfault after ~24h idle on Windows 11 with sleep/wake cycles #28175 - Windows segfault after ~24h idle with sleep/wake cycles; matches Thread::suspend retry logic for transient SuspendThread/GetThreadContext failures
  6. Segfault on Windows x64 (Bun v1.3.14) - crash at ~960MB RSS with 316K page faults #32683 - Windows x64 segfault at ~960MB RSS with 316K page faults; consistent with GC scanning uninitialized CONTEXT bytes
  7. Segfault (null pointer at 0x0) in long-running standalone executable on Windows after sustained memory pressure #26862 - Windows long-running standalone null dereference after 81.9M page faults; sustained memory pressure crash consistent with scanning stale PlatformRegisters
  8. Windows: Bun 1.3.14 segfaults in long-running localhost HTTP proxy #32585 - Windows long-running HTTP proxy segfault at 0xFFFFFFFFFFFFFFFF; address consistent with scanning uninitialized memory during GC conservative root scan
  9. Title: Segmentation fault on Windows 11 when running OpenCode (Bun v1.3.14) #32691 - Windows segfault during OpenCode operations; crash pattern consistent with Windows GC conservative scan of uninitialized CONTEXT bytes
  10. Segmentation fault on Windows exit Bun v1.3.13 bundled in opencode #30745 - Windows segfault on exit after long session; consistent with missed roots or stale frames causing use-after-free during final GC
  11. Bun v1.3.10 crashes with segmentation fault on Windows 10 x64 #27414 - Windows 10 segfault at 0x18 after 10.62GB RSS; consistent with GC missing live roots due to failed thread suspension or uninitialized CONTEXT

If this is helpful, copy the block below into the PR description to auto-close these issues on merge.

Fixes #31832
Fixes #34476
Fixes #27312
Fixes #20429
Fixes #28175
Fixes #32683
Fixes #26862
Fixes #32585
Fixes #32691
Fixes #30745
Fixes #27414

🤖 Generated with Claude Code

Picks up oven-sh/WebKit#382 (87d87c14), which is on top of WebKit main
9f8f24db19. Four changes to the Windows conservative stack scan:

- Thread::getRegisters: RELEASE_ASSERT on GetThreadContext failure and
  return only the populated CONTEXT_INTEGER|CONTEXT_CONTROL prefix
  (256 bytes on x64 instead of sizeof(CONTEXT)=1232).
- MachineThreads::tryCopyOtherThreadStack: value-initialize
  PlatformRegisters so unpopulated bytes scan as zero, not stale
  collector stack.
- Thread::suspend: retry transient SuspendThread/GetThreadContext
  failures (spin then Sleep, up to 100 attempts). tryCopyOtherThreadStacks
  now RELEASE_ASSERTs if a live thread still cannot be suspended rather
  than silently skipping its roots.
- RegisterState: use the explicit callee-save inline-asm capture on
  clang-cl (Win64 variant with rbx/rbp/rdi/rsi/r12-r15) instead of the
  256-byte setjmp fallback. Also adds rbp to the SysV x86_64 list.

Also pulls in the intervening WebKit-main commits 34c01d13..9f8f24db
(shorthand-in-arrow arguments-capture fix, CodeBlock-aging gating,
Dockerfile.windows CI fixes).
@robobun
robobun force-pushed the farm/c9105e62/webkit-win-gc-hardening branch from cb5ce0d to b6078c2 Compare August 2, 2026 11:06
@robobun

robobun commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator Author

CI summary for autobuild-preview-pr-382-87d87c14 (build #87798):

  • 194/196 jobs passed; 2 darwin-14-aarch64 test shards still scheduled.
  • 11 tests flaked and passed on retry; none are [new] vs main.
  • The one Windows GC-adjacent flake, test/napi/napi.test.ts ("Condition was not met after 100 GC attempts" in napi_wrap > has the right lifetime), also flakes on main in 3 of the last 5 builds (87824, 87814, 87805). The WebKit changes in this PR strictly reduce the bytes scanned as conservative roots, so they cannot increase retention.

WebKit CI for 87d87c14 is all green (41/41 jobs) across all platforms including Windows x64/arm64 debug/release/asan/lto.

No regressions observed. Ready to merge oven-sh/WebKit#382 to main and re-point WEBKIT_VERSION here at the merged sha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants