Commit cc61b03
committed
src,win: disable Maglev when Windows CET shadow stacks are active
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: #622601 parent 4579957 commit cc61b03
2 files changed
Lines changed: 55 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
119 | 119 | | |
120 | 120 | | |
121 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
122 | 129 | | |
123 | 130 | | |
124 | 131 | | |
| |||
867 | 874 | | |
868 | 875 | | |
869 | 876 | | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
870 | 917 | | |
871 | 918 | | |
872 | 919 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1246 | 1246 | | |
1247 | 1247 | | |
1248 | 1248 | | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
1249 | 1257 | | |
1250 | 1258 | | |
1251 | 1259 | | |
| |||
0 commit comments