commit | 2e1dabaa1acf008dd7c3b12cfb59bddbe05dba93 | [log] [tgz] |
---|---|---|
author | Daniel Verkamp <dverkamp@chromium.org> | Tue Jan 24 14:12:18 2023 -0800 |
committer | crosvm LUCI <crosvm-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Jan 27 20:39:43 2023 +0000 |
tree | 47d2224522abe7534c0f7030a3063b94c77086c1 | |
parent | 81d15d9de24363d143239f2ba43a175c30e5865e [diff] |
base: panic_handler: abort in memfd panic hook The default behavior when handling a panic in a multi-threaded Rust program is to terminate only the thread that panicked; other threads continue running. In order to get a crash dump (and to prevent the program from continuing to run in an inconsistent state), add a call to abort the whole program at the end of the panic hook installed by install_memfd_handler(). The crosvm panic hook configured by set_panic_hook() already behaves this way, but adding this behavior to install_memfd_handler() will cause it to be used in all ChromeOS Rust programs that use the hook from libchromeos. Test program: ``` fn main() { println!("hello world"); install_memfd_handler(); thread::Builder::new() .name("crashtest".into()) .spawn(|| { println!("about to panic"); panic!("test panic"); }) .unwrap(); } println!("continuing to run main"); thread::sleep(Duration::from_secs(1)); } ``` BUG=b:234093439 TEST=panic in multithreaded test program; observe core Change-Id: I2340b2f54607651fe577ebf44a0ecb12e409cef4 Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/4190031 Reviewed-by: Allen Webb <allenwebb@google.com> Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
crosvm is a virtual machine monitor (VMM) based on Linux’s KVM hypervisor, with a focus on simplicity, security, and speed. crosvm is intended to run Linux guests, originally as a security boundary for running native applications on the ChromeOS platform. Compared to QEMU, crosvm doesn’t emulate architectures or real hardware, instead concentrating on paravirtualized devices, such as the virtio standard.
crosvm is currently used to run Linux/Android guests on ChromeOS devices.