7120c58297
* chore: bump node in DEPS to v20.12.0 * chore: update build_add_gn_build_files.patch * chore: update patches * chore: bump node in DEPS to v20.12.1 * chore: update patches * build: encode non-ASCII Latin1 characters as one byte in JS2C https://github.com/nodejs/node/pull/51605 * crypto: use EVP_MD_fetch and cache EVP_MD for hashes https://github.com/nodejs/node/pull/51034 * chore: update filenames.json * chore: bump node in DEPS to v20.12.2 * chore: update patches * src: support configurable snapshot https://github.com/nodejs/node/pull/50453 * test: remove test-domain-error-types flaky designation https://github.com/nodejs/node/pull/51717 * src: avoid draining platform tasks at FreeEnvironment https://github.com/nodejs/node/pull/51290 * chore: fix accidentally deleted v8 dep * lib: define FormData and fetch etc. in the built-in snapshot https://github.com/nodejs/node/pull/51598 * chore: rebase on main * chore: remove stray log --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Cheng <zcbenz@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Shelley Vohr <shelley.vohr@gmail.com>
|
|
Date: Thu, 16 Nov 2023 16:48:10 +0100
|
|
Subject: feat: optionally prevent calling V8::EnableWebAssemblyTrapHandler
|
|
|
|
V8::EnableWebAssemblyTrapHandler can be called only once or it will
|
|
hard crash. We need to prevent Node.js calling it in the event it has
|
|
already been called.
|
|
|
|
This should be upstreamed.
|
|
|
|
diff --git a/src/node.cc b/src/node.cc
|
|
index 012dd487e8db232d068bce358ad44b14e78d0fe9..a1062226bebd18ec84302ebdc4c4dbac352f51ae 100644
|
|
--- a/src/node.cc
|
|
+++ b/src/node.cc
|
|
@@ -650,6 +650,7 @@ static void PlatformInit(ProcessInitializationFlags::Flags flags) {
|
|
#endif
|
|
}
|
|
#endif // defined(_WIN32)
|
|
+ if (!(flags & ProcessInitializationFlags::kNoEnableWasmTrapHandler))
|
|
V8::EnableWebAssemblyTrapHandler(false);
|
|
#endif // NODE_USE_V8_WASM_TRAP_HANDLER
|
|
}
|
|
diff --git a/src/node.h b/src/node.h
|
|
index 16c3ad349e942b83764c7772178baa5057cd64f3..5ade64874ec08474f05db226cf19a043fa26592e 100644
|
|
--- a/src/node.h
|
|
+++ b/src/node.h
|
|
@@ -275,6 +275,10 @@ enum Flags : uint32_t {
|
|
kNoInitializeCppgc = 1 << 13,
|
|
// Initialize the process for predictable snapshot generation.
|
|
kGeneratePredictableSnapshot = 1 << 14,
|
|
+ // Do not initialize the Web Assembly trap handler. This is used by
|
|
+ // embedders to account for the case where it may already have been
|
|
+ // initialized - calling it more than once will hard crash.
|
|
+ kNoEnableWasmTrapHandler = 1 << 15,
|
|
|
|
// Emulate the behavior of InitializeNodeWithArgs() when passing
|
|
// a flags argument to the InitializeOncePerProcess() replacement
|