Skip to content

Commit 73ef3f2

Browse files
addaleaxrichardlau
authored andcommitted
src: disallow JS execution during exit()
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: #35020 Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Shelley Vohr <[email protected]>
1 parent 3d41ff2 commit 73ef3f2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/env.cc

+2
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,8 @@ uv_key_t Environment::thread_local_env = {};
964964
void Environment::Exit(int exit_code) {
965965
if (options()->trace_exit) {
966966
HandleScope handle_scope(isolate());
967+
Isolate::DisallowJavascriptExecutionScope disallow_js(
968+
isolate(), Isolate::DisallowJavascriptExecutionScope::CRASH_ON_FAILURE);
967969

968970
if (is_main_thread()) {
969971
fprintf(stderr, "(node:%d) ", uv_os_getpid());

0 commit comments

Comments
 (0)