Skip to content

Commit

Permalink
vmm: replace process::exit with libc::_exit
Browse files Browse the repository at this point in the history
We did this because process::exit causes some extra syscalls to be
invoked, and we don't want to whitelist them. Using libc::_exit
will terminate the process more abruptly, but that's not an issue
in our case, because we don't create/use resources which are not
implicitly cleaned up by the OS on process termination.

Signed-off-by: Alexandru Agache <[email protected]>
  • Loading branch information
alexandruag authored and dhrgit committed Feb 22, 2019
1 parent 62f3c6f commit 054c007
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vmm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1268,8 +1268,11 @@ impl Vmm {
error!("Failed to log metrics while stopping: {}", e);
}

// Exit from Firecracker using the provided exit code.
std::process::exit(exit_code);
// Exit from Firecracker using the provided exit code. Safe because we're terminating
// the process anyway.
unsafe {
libc::_exit(exit_code);
}
}

fn is_instance_initialized(&self) -> bool {
Expand Down

0 comments on commit 054c007

Please sign in to comment.