Closed
Conversation
When a Node.js process runs on a Windows build that enforces hardware CET (Control-flow Enforcement Technology) shadow stacks but the binary was not compiled with V8_ENABLE_CET_SHADOW_STACK support, V8's Maglev deoptimizer reconstructs call stack frames without synchronizing the hardware shadow stack. When the CPU subsequently executes a RET instruction, the return address on the regular stack does not match the address on the shadow stack, causing a STATUS_STACK_BUFFER_OVERRUN (0xC0000409) termination via __fastfail with no JavaScript stack trace. Detect active CET shadow stacks at startup via GetProcessMitigationPolicy(ProcessUserShadowStackPolicy) and automatically apply --no-maglev when the binary lacks V8_ENABLE_CET_SHADOW_STACK support. TurboFan remains active so JIT performance and fetch() are preserved. The detection is a no-op on platforms without CET and compiles to nothing when V8_ENABLE_CET_SHADOW_STACK is enabled, making this fully forward- compatible with future V8 CET support. Also register --maglev and --no-maglev as kAllowedInEnvvar options so users can override the auto-detection via NODE_OPTIONS. Fixes: nodejs#62260
Verify that --no-maglev and --maglev are accepted in NODE_OPTIONS (regression guard for the kAllowedInEnvvar addition in the previous commit). Add a Windows-specific test that confirms the process starts cleanly when those flags are passed via the environment variable. The actual CET hardware auto-disable path requires OS-level shadow stack enforcement and is covered by manual testing on Windows 11 Insider builds; this test covers the observable envvar interface.
Collaborator
|
Review requested:
|
Member
|
Issues with the V8 compiler should be reported and fixed in V8. We shouldn't be hacking this at the embedder layer. |
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.
No description provided.