Skip to content

fix: dangling CFunction pointer in node:wasi fast API calls#51867

Merged
MarshallOfSound merged 1 commit into
42-x-yfrom
fix-wasi-cfunction-lifetime-42-x-y
Jun 3, 2026
Merged

fix: dangling CFunction pointer in node:wasi fast API calls#51867
MarshallOfSound merged 1 commit into
42-x-yfrom
fix-wasi-cfunction-lifetime-42-x-y

Conversation

@MarshallOfSound

Copy link
Copy Markdown
Member

Fixes the wasi/test-wasi-* SIGSEGVs on 42-x-y reported in #51859 (comment) (deepak1556) after #51831.

Notes: Fixed a crash when calling node:wasi functions with fast API calls enabled.

Since the V8 change to store the v8::CFunction pointer directly in
FunctionTemplateInfo (backported for node startup snapshot support),
the CFunction passed to FunctionTemplate::New must outlive the
template. WasiFunction::SetFunction kept it in a stack local, leaving
a dangling pointer that TurboFan dereferences when compiling the fast
API call, crashing all wasi tests under --turbo-fast-api-calls.

Make the per-instantiation CFunction static, mirroring the wasi half
of nodejs/node#62572; the matching external reference registration fix
already shipped in the snapshot patch.
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner June 3, 2026 17:37
@MarshallOfSound MarshallOfSound added the semver/patch backwards-compatible bug fixes label Jun 3, 2026
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jun 3, 2026
@MarshallOfSound MarshallOfSound added the backport-check-skip Skip trop's backport validity checking label Jun 3, 2026
@electron-cation electron-cation Bot added new-pr 🌱 PR opened recently and removed new-pr 🌱 PR opened recently labels Jun 3, 2026
@MarshallOfSound MarshallOfSound merged commit 061dd9c into 42-x-y Jun 3, 2026
73 checks passed
@MarshallOfSound MarshallOfSound deleted the fix-wasi-cfunction-lifetime-42-x-y branch June 3, 2026 18:34
@release-clerk

release-clerk Bot commented Jun 3, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed a crash when calling node:wasi functions with fast API calls enabled.

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

Labels

backport-check-skip Skip trop's backport validity checking semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants