diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-05-20 01:57:17 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-06-14 19:11:40 +0200 |
commit | e2562047763a666599b64d016cdbf399dab855d8 (patch) | |
tree | 26f7d5f61795169924066892acfba709c3f04ae8 /src/node_process_methods.cc | |
parent | e6b3ec3d3c553200fa98ed47dff12d58ebedf8a2 (diff) | |
download | android-node-v8-e2562047763a666599b64d016cdbf399dab855d8.tar.gz android-node-v8-e2562047763a666599b64d016cdbf399dab855d8.tar.bz2 android-node-v8-e2562047763a666599b64d016cdbf399dab855d8.zip |
src: reset SIGSEGV handler before crashing
Without this, we would re-enter the signal handler immediately
after re-raising the signal, leading to an infinite loop.
PR-URL: https://github.com/nodejs/node/pull/27775
Refs: https://github.com/nodejs/node/pull/27246
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r-- | src/node_process_methods.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index a9ddd70bcb..912ac9bec2 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -63,6 +63,12 @@ static void Abort(const FunctionCallbackInfo<Value>& args) { Abort(); } +// For internal testing only, not exposed to userland. +static void CauseSegfault(const FunctionCallbackInfo<Value>& args) { + // This should crash hard all platforms. + *static_cast<void**>(nullptr) = nullptr; +} + static void Chdir(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args); CHECK(env->owns_process_state()); @@ -405,6 +411,7 @@ static void InitializeProcessMethods(Local<Object> target, env->SetMethod(target, "_debugProcess", DebugProcess); env->SetMethod(target, "_debugEnd", DebugEnd); env->SetMethod(target, "abort", Abort); + env->SetMethod(target, "causeSegfault", CauseSegfault); env->SetMethod(target, "chdir", Chdir); } |