electron/patches/node/enable_crashpad_linux_node_processes.patch

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
2.4 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: VerteDinde <keeleymhammond@gmail.com>
Date: Sun, 20 Nov 2022 21:45:20 -0800
Subject: fix: enable crashpad for ELECTRON_RUN_AS_NODE linux processes
Passes the crashpad handler PID and crashdump signal file descriptor
to child processes spawned with `ELECTRON_RUN_AS_NODE` which is used
by the crashpad client to connect with the handler process.
diff --git a/lib/child_process.js b/lib/child_process.js
chore: bump node to v22.13.1 (35-x-y) (#45216) * chore: bump node in DEPS to v22.13.0 * chore: bump node in DEPS to v22.13.1 * src: move evp stuff to ncrypto https://github.com/nodejs/node/pull/54911 * crypto: add Date fields for validTo and validFrom https://github.com/nodejs/node/pull/54159 * module: fix discrepancy between .ts and .js https://github.com/nodejs/node/pull/54461 * esm: do not interpret "main" as a URL https://github.com/nodejs/node/pull/55003 * src: modernize likely/unlikely hints https://github.com/nodejs/node/pull/55155 * chore: update patch indices * crypto: add validFromDate and validToDate fields to X509Certificate https://github.com/nodejs/node/pull/54159 * chore: fixup perfetto patch * fix: clang warning in simdjson * src: add receiver to fast api callback methods https://github.com/nodejs/node/pull/54408 * chore: fixup revert patch * fixup! esm: do not interpret "main" as a URL * fixup! crypto: add Date fields for validTo and validFrom * fix: move ArrayBuffer test patch * src: fixup Error.stackTraceLimit during snapshot building https://github.com/nodejs/node/pull/55121 * fix: bad rebase * chore: fixup amaro * chore: address feedback from review * src: revert filesystem::path changes https://github.com/nodejs/node/pull/55015 * chore: fixup GN build file * https://github.com/nodejs/node/pull/55529 * https://github.com/nodejs/node/pull/55798 * https://github.com/nodejs/node/pull/55530 * module: simplify --inspect-brk handling https://github.com/nodejs/node/pull/55679 * src: fix outdated js2c.cc references https://github.com/nodejs/node/pull/56133 * crypto: include openssl/rand.h explicitly https://github.com/nodejs/node/pull/55425 * build: use variable for crypto dep path https://github.com/nodejs/node/pull/55928 * crypto: fix RSA_PKCS1_PADDING error message https://github.com/nodejs/node/pull/55629 * build: use variable for simdutf path https://github.com/nodejs/node/pull/56196 * test,crypto: make crypto tests work with BoringSSL https://github.com/nodejs/node/pull/55491 * fix: suppress clang -Wdeprecated-declarations in libuv https://github.com/libuv/libuv/pull/4486 * deps: update libuv to 1.49.1 https://github.com/nodejs/node/pull/55114 * test: make test-node-output-v8-warning more flexible https://github.com/nodejs/node/pull/55401 * [v22.x] Revert "v8: enable maglev on supported architectures" https://github.com/nodejs/node/pull/54384 * fix: potential WIN32_LEAN_AND_MEAN redefinition https://github.com/c-ares/c-ares/pull/869 * deps: update nghttp2 to 1.64.0 https://github.com/nodejs/node/pull/55559 * src: provide workaround for container-overflow https://github.com/nodejs/node/pull/55591 * build: use variable for simdutf path https://github.com/nodejs/node/pull/56196 * chore: fixup patch indices * fixup! module: simplify --inspect-brk handling * lib: fix fs.readdir recursive async https://github.com/nodejs/node/pull/56041 * lib: avoid excluding symlinks in recursive fs.readdir with filetypes https://github.com/nodejs/node/pull/55714/ This doesn't currently play well with ASAR - this should be fixed in a follow up * test: disable CJS permission test for config.main This has diverged as a result of our revert of src,lb: reducing C++ calls of esm legacy main resolve * fixup! lib: fix fs.readdir recursive async * deps: update libuv to 1.49.1 https://github.com/nodejs/node/pull/55114 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 15:53:34 +01:00
index bb27670112c1ea42c7ff00883fe4b684544d9cd4..4d4da798ce59ce42e42d1f05fccf07699c033d46 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -61,6 +61,7 @@ let debug = require('internal/util/debuglog').debuglog(
);
const { Buffer } = require('buffer');
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
+const { getCrashdumpSignalFD, getCrashpadHandlerPID } = process._linkedBinding('electron_common_crashpad_support');
const {
AbortError,
@@ -153,7 +154,6 @@ function fork(modulePath, args = [], options) {
ArrayPrototypeSplice(execArgv, index - 1, 2);
}
}
-
args = [...execArgv, modulePath, ...args];
if (typeof options.stdio === 'string') {
chore: bump node to v22.13.1 (35-x-y) (#45216) * chore: bump node in DEPS to v22.13.0 * chore: bump node in DEPS to v22.13.1 * src: move evp stuff to ncrypto https://github.com/nodejs/node/pull/54911 * crypto: add Date fields for validTo and validFrom https://github.com/nodejs/node/pull/54159 * module: fix discrepancy between .ts and .js https://github.com/nodejs/node/pull/54461 * esm: do not interpret "main" as a URL https://github.com/nodejs/node/pull/55003 * src: modernize likely/unlikely hints https://github.com/nodejs/node/pull/55155 * chore: update patch indices * crypto: add validFromDate and validToDate fields to X509Certificate https://github.com/nodejs/node/pull/54159 * chore: fixup perfetto patch * fix: clang warning in simdjson * src: add receiver to fast api callback methods https://github.com/nodejs/node/pull/54408 * chore: fixup revert patch * fixup! esm: do not interpret "main" as a URL * fixup! crypto: add Date fields for validTo and validFrom * fix: move ArrayBuffer test patch * src: fixup Error.stackTraceLimit during snapshot building https://github.com/nodejs/node/pull/55121 * fix: bad rebase * chore: fixup amaro * chore: address feedback from review * src: revert filesystem::path changes https://github.com/nodejs/node/pull/55015 * chore: fixup GN build file * https://github.com/nodejs/node/pull/55529 * https://github.com/nodejs/node/pull/55798 * https://github.com/nodejs/node/pull/55530 * module: simplify --inspect-brk handling https://github.com/nodejs/node/pull/55679 * src: fix outdated js2c.cc references https://github.com/nodejs/node/pull/56133 * crypto: include openssl/rand.h explicitly https://github.com/nodejs/node/pull/55425 * build: use variable for crypto dep path https://github.com/nodejs/node/pull/55928 * crypto: fix RSA_PKCS1_PADDING error message https://github.com/nodejs/node/pull/55629 * build: use variable for simdutf path https://github.com/nodejs/node/pull/56196 * test,crypto: make crypto tests work with BoringSSL https://github.com/nodejs/node/pull/55491 * fix: suppress clang -Wdeprecated-declarations in libuv https://github.com/libuv/libuv/pull/4486 * deps: update libuv to 1.49.1 https://github.com/nodejs/node/pull/55114 * test: make test-node-output-v8-warning more flexible https://github.com/nodejs/node/pull/55401 * [v22.x] Revert "v8: enable maglev on supported architectures" https://github.com/nodejs/node/pull/54384 * fix: potential WIN32_LEAN_AND_MEAN redefinition https://github.com/c-ares/c-ares/pull/869 * deps: update nghttp2 to 1.64.0 https://github.com/nodejs/node/pull/55559 * src: provide workaround for container-overflow https://github.com/nodejs/node/pull/55591 * build: use variable for simdutf path https://github.com/nodejs/node/pull/56196 * chore: fixup patch indices * fixup! module: simplify --inspect-brk handling * lib: fix fs.readdir recursive async https://github.com/nodejs/node/pull/56041 * lib: avoid excluding symlinks in recursive fs.readdir with filetypes https://github.com/nodejs/node/pull/55714/ This doesn't currently play well with ASAR - this should be fixed in a follow up * test: disable CJS permission test for config.main This has diverged as a result of our revert of src,lb: reducing C++ calls of esm legacy main resolve * fixup! lib: fix fs.readdir recursive async * deps: update libuv to 1.49.1 https://github.com/nodejs/node/pull/55114 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 15:53:34 +01:00
@@ -609,6 +609,22 @@ function normalizeSpawnArguments(file, args, options) {
'options.windowsVerbatimArguments');
}
+ const env = options.env || process.env;
+
+ if ((process.platform === 'linux') &&
+ ObjectPrototypeHasOwnProperty(env, 'ELECTRON_RUN_AS_NODE') &&
+ (file === process.execPath)) {
+ // On Linux, pass the file descriptor which crashpad handler process
+ // uses to monitor the child process and PID of the handler process.
+ // https://source.chromium.org/chromium/chromium/src/+/110.0.5415.0:components/crash/core/app/crashpad_linux.cc;l=199-206
+ const fd = getCrashdumpSignalFD();
+ const pid = getCrashpadHandlerPID();
+ if (fd !== -1 && pid !== -1) {
+ env.CRASHDUMP_SIGNAL_FD = fd;
+ env.CRASHPAD_HANDLER_PID = pid;
+ }
+ }
+
if (options.shell) {
chore: bump node to v18.13.0 (main) (#36818) * chore: bump node in DEPS to v18.13.0 * child_process: validate arguments for null bytes https://github.com/nodejs/node/pull/44782 * bootstrap: merge main thread and worker thread initializations https://github.com/nodejs/node/pull/44869 * module: ensure relative requires work from deleted directories https://github.com/nodejs/node/pull/42384 * src: add support for externally shared js builtins https://github.com/nodejs/node/issues/44000 * lib: disambiguate `native module` to `binding` https://github.com/nodejs/node/pull/45673 * test: convert test-debugger-pid to async/await https://github.com/nodejs/node/pull/45179 * deps: upgrade to libuv 1.44.2 https://github.com/nodejs/node/pull/42340 * src: fix cppgc incompatibility in v8 https://github.com/nodejs/node/pull/43521 * src: use qualified `std::move` call in node_http2 https://github.com/nodejs/node/pull/45555 * build: fix env.h for cpp20 https://github.com/nodejs/node/pull/45516 * test: remove experimental-wasm-threads flag https://github.com/nodejs/node/pull/45074 * src: iwyu in cleanup_queue.cc https://github.com/nodejs/node/pull/44983 * src: add missing include for `std::all_of` https://github.com/nodejs/node/pull/45541 * deps: update ICU to 72.1 https://github.com/nodejs/node/pull/45068 * chore: fixup patch indices * chore: remove errant semicolons - https://github.com/nodejs/node/pull/44179 - https://github.com/nodejs/node/pull/44193 * src: add support for externally shared js builtins https://github.com/nodejs/node/pull/44376 * chore: add missing GN filenames * deps: update nghttp2 to 1.51.0 https://github.com/nodejs/node/pull/45537 * chore: disable more Node.js snapshot tests The Snapshot feature is currently disabled * chore: disable ICU timezone tests Node.js uses a different version of ICU than Electron so they will often be out of sync. * chore: disable threadpool event tracing test Event tracing is not enabled in embedded Node.js * chore: fixup patch indices * chore: comments from review Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2023-01-11 11:33:48 +01:00
validateArgumentNullCheck(options.shell, 'options.shell');
const command = ArrayPrototypeJoin([file, ...args], ' ');
chore: bump node to v22.13.1 (35-x-y) (#45216) * chore: bump node in DEPS to v22.13.0 * chore: bump node in DEPS to v22.13.1 * src: move evp stuff to ncrypto https://github.com/nodejs/node/pull/54911 * crypto: add Date fields for validTo and validFrom https://github.com/nodejs/node/pull/54159 * module: fix discrepancy between .ts and .js https://github.com/nodejs/node/pull/54461 * esm: do not interpret "main" as a URL https://github.com/nodejs/node/pull/55003 * src: modernize likely/unlikely hints https://github.com/nodejs/node/pull/55155 * chore: update patch indices * crypto: add validFromDate and validToDate fields to X509Certificate https://github.com/nodejs/node/pull/54159 * chore: fixup perfetto patch * fix: clang warning in simdjson * src: add receiver to fast api callback methods https://github.com/nodejs/node/pull/54408 * chore: fixup revert patch * fixup! esm: do not interpret "main" as a URL * fixup! crypto: add Date fields for validTo and validFrom * fix: move ArrayBuffer test patch * src: fixup Error.stackTraceLimit during snapshot building https://github.com/nodejs/node/pull/55121 * fix: bad rebase * chore: fixup amaro * chore: address feedback from review * src: revert filesystem::path changes https://github.com/nodejs/node/pull/55015 * chore: fixup GN build file * https://github.com/nodejs/node/pull/55529 * https://github.com/nodejs/node/pull/55798 * https://github.com/nodejs/node/pull/55530 * module: simplify --inspect-brk handling https://github.com/nodejs/node/pull/55679 * src: fix outdated js2c.cc references https://github.com/nodejs/node/pull/56133 * crypto: include openssl/rand.h explicitly https://github.com/nodejs/node/pull/55425 * build: use variable for crypto dep path https://github.com/nodejs/node/pull/55928 * crypto: fix RSA_PKCS1_PADDING error message https://github.com/nodejs/node/pull/55629 * build: use variable for simdutf path https://github.com/nodejs/node/pull/56196 * test,crypto: make crypto tests work with BoringSSL https://github.com/nodejs/node/pull/55491 * fix: suppress clang -Wdeprecated-declarations in libuv https://github.com/libuv/libuv/pull/4486 * deps: update libuv to 1.49.1 https://github.com/nodejs/node/pull/55114 * test: make test-node-output-v8-warning more flexible https://github.com/nodejs/node/pull/55401 * [v22.x] Revert "v8: enable maglev on supported architectures" https://github.com/nodejs/node/pull/54384 * fix: potential WIN32_LEAN_AND_MEAN redefinition https://github.com/c-ares/c-ares/pull/869 * deps: update nghttp2 to 1.64.0 https://github.com/nodejs/node/pull/55559 * src: provide workaround for container-overflow https://github.com/nodejs/node/pull/55591 * build: use variable for simdutf path https://github.com/nodejs/node/pull/56196 * chore: fixup patch indices * fixup! module: simplify --inspect-brk handling * lib: fix fs.readdir recursive async https://github.com/nodejs/node/pull/56041 * lib: avoid excluding symlinks in recursive fs.readdir with filetypes https://github.com/nodejs/node/pull/55714/ This doesn't currently play well with ASAR - this should be fixed in a follow up * test: disable CJS permission test for config.main This has diverged as a result of our revert of src,lb: reducing C++ calls of esm legacy main resolve * fixup! lib: fix fs.readdir recursive async * deps: update libuv to 1.49.1 https://github.com/nodejs/node/pull/55114 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
2025-02-14 15:53:34 +01:00
@@ -642,7 +658,6 @@ function normalizeSpawnArguments(file, args, options) {
ArrayPrototypeUnshift(args, file);
}
- const env = options.env || process.env;
const envPairs = [];
// process.env.NODE_V8_COVERAGE always propagates, making it possible to