Skip to content

Commit ecbbf4a

Browse files
rmacnak-googleCommit Queue
authored andcommitted
[test] Bypass global destructors when exiting without shutting down the VM.
Running global destructors can interfer with VM code running on other threads, including causing MSAN to flag accesses as using uninitialized memory. TEST=msan, ffi/vmspecific_function_callbacks_exit_test Change-Id: Ia9a7223ecc81690a2047e5936b9a138fff620ad1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/424241 Commit-Queue: Ryan Macnak <[email protected]> Reviewed-by: Alexander Aprelev <[email protected]>
1 parent 45d187e commit ecbbf4a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

runtime/bin/ffi_test/ffi_test_functions_vmspecific.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,14 @@ intptr_t ExpectAbort(void (*fn)()) {
231231
} else {
232232
// Caught the setjmp.
233233
sigaction(SIGABRT, &old_action, nullptr);
234-
exit(0);
234+
235+
// _exit not exit. Because we're not doing a clean VM shutdown, we need to
236+
// avoid running global destructors while other isolates and background
237+
// compilers are still running.
238+
_exit(0);
235239
}
236240
fprintf(stderr, "Expected abort!!!\n");
237-
exit(1);
241+
_exit(1);
238242
}
239243

240244
void* TestCallbackOnThreadOutsideIsolate(void* parameter) {

0 commit comments

Comments
 (0)