Skip to content

Commit b3cd090

Browse files
committed
cli: allow running wasm in limited vmemory with --disable-wasm-trap-handler
nodejs/node#52766
1 parent 551e2a2 commit b3cd090

File tree

3 files changed

+9
-41
lines changed

3 files changed

+9
-41
lines changed

patches/node/feat_optionally_prevent_calling_v8_enablewebassemblytraphandler.patch

Lines changed: 0 additions & 38 deletions
This file was deleted.

script/node-disabled-tests.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,6 @@
160160
"sequential/test-single-executable-application-snapshot-and-code-cache",
161161
"sequential/test-single-executable-application-use-code-cache",
162162
"sequential/test-tls-connect",
163-
"wpt/test-webcrypto"
163+
"wpt/test-webcrypto",
164+
"wasm-allocation/test-wasm-allocation"
164165
]

shell/common/node_bindings.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,15 @@ void NodeBindings::Initialize(v8::Local<v8::Context> context) {
531531

532532
// Parse and set Node.js cli flags.
533533
std::vector<std::string> args = ParseNodeCliFlags();
534+
535+
// V8::EnableWebAssemblyTrapHandler can be called only once or it will
536+
// hard crash. We need to prevent Node.js calling it in the event it has
537+
// already been called.
538+
node::per_process::cli_options->disable_wasm_trap_handler = true;
539+
534540
uint64_t process_flags =
535541
node::ProcessInitializationFlags::kNoInitializeV8 |
536-
node::ProcessInitializationFlags::kNoInitializeNodeV8Platform |
537-
node::ProcessInitializationFlags::kNoEnableWasmTrapHandler;
542+
node::ProcessInitializationFlags::kNoInitializeNodeV8Platform;
538543

539544
// We do not want the child processes spawned from the utility process
540545
// to inherit the custom stdio handles created for the parent.

0 commit comments

Comments
 (0)