From 73ef3f2f050a874712d1770ddd4e02930a638eda Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 2 Sep 2020 14:42:09 +0200 Subject: [PATCH] src: disallow JS execution during exit() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is just an extra safeguard – no JS should run once we’ve decided that we are going to shutdown the process, but we’re opening a handle scope in order to access V8, so make sure that our operations do not lead to JS accidentally being run. PR-URL: https://github.com/nodejs/node/pull/35020 Reviewed-By: Gus Caplan Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: David Carlier Reviewed-By: Shelley Vohr --- src/env.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/env.cc b/src/env.cc index 6a70bcdca4ae1c..3ad13dd94a0954 100644 --- a/src/env.cc +++ b/src/env.cc @@ -964,6 +964,8 @@ uv_key_t Environment::thread_local_env = {}; void Environment::Exit(int exit_code) { if (options()->trace_exit) { HandleScope handle_scope(isolate()); + Isolate::DisallowJavascriptExecutionScope disallow_js( + isolate(), Isolate::DisallowJavascriptExecutionScope::CRASH_ON_FAILURE); if (is_main_thread()) { fprintf(stderr, "(node:%d) ", uv_os_getpid());