Conversation
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Original commit message:
[wasm] Add CHECKs for wrapper refcount
We're seeing some crash reports that could be explained by
"zombie" wrappers (freed by one code path while still in use
by another, which then turns into UAF). To confirm or reject
this hypothesis and shed some light on *which* code path might
free wrappers too eagerly, this patch adds a few CHECKs.
Bug: 407003348
Change-Id: Ic2b527acafdd57aadd51703041c1ab65f7bf7b2c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6415929
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Commit-Queue: Matthias Liedtke <mliedtke@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99572}
Refs: v8/v8@68210d5
Original commit message:
[wasm] Fix lookup of wrappers marked "is_dying"
We must not add a dying wrapper to the current WasmCodeRefScope.
Doing so creates a possibility that a wrapper that's about to be
deleted by another thread (after going through a Wasm Code GC cycle)
will be deleted again by that WasmCodeRefScope.
To fix this, this patch merges the "is_dying" bit and the refcount
into a single bit field that can be updated atomically, and updates
the WasmImportWrapperCache to use the new, more careful machinery.
This definitely fixes issue 409379692, hopefully also 407003348.
Bug: 407003348
Change-Id: Ib83e9df034e8ddf3590828aea86741779ef92ab9
Fixed: 409379692
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6450127
Reviewed-by: Matthias Liedtke <mliedtke@chromium.org>
Auto-Submit: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#99765}
Refs: v8/v8@9b8ca54
ThatKJ
force-pushed
the
fix-v24-wasm-wrapper
branch
from
September 28, 2026 09:38
2188a9d to
0385bee
Compare
|
Tested this: the deps/v8 diff here is identical to what I built from 13987f4 in https://github.com/owen-harborcoat/wasmer-agent-sandbox/actions/runs/36353991873. With it, 0 V8 crashes in 191 repro processes; without it, 8 in 149. |
Author
|
@owen-harborcoat Thanks for testing this and sharing the results! Really helpful to have an independent reproduction confirming the backported V8 diff eliminates the crashes in this workload. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backports the V8 fixes for the wasm import wrapper lifetime issue reported in #66366.
This includes:
68210d500a— adds wrapper refcount checks9b8ca54d5a— fixes lookup of wrappers already marked asis_dyingThe latter prevents a dying wrapper from being added to the current
WasmCodeRefScope, avoiding the race that can lead to thejit_page_->allocations_.erase(addr) == 1CHECK / crash.Both commits applied cleanly to
v24.x-staging, and thev8_embedder_stringwas incremented for each backport.Local Node build completed successfully.
Refs: #66366