mythril
mythril copied to clipboard
QEMU shutdown on panic
Mythril's panic_handler will currently spin in halt:
https://github.com/mythril-hypervisor/mythril/blob/af161a464ede3f6e8ffe5723c5d356125e8f47e8/mythril/src/error.rs#L138-L143
I think it would be worthwhile to allow mythril to use the isa-debug-exit device to cause QEMU to exit with an error code if mythril panics. However @dlrobertson mentioned that he would like to see this configurable.
The following commit will allow qemu to exit on panic, but my question is about how to make it configurable:
https://github.com/sruffell/mythril/commit/912f08c27af67b0c78e0c5a868e7bb1de9fa70b5
Currently, this can be turned on and off by adding/removing -device isa-debug-exit on the QEMU command-line but was there another idea about how to configure this? Should the mythril.cfg file have an option that would control whether the panic handler even tries to do the port IO to the isa-debug-exit device?
I do think that long term having some option for configuring how a VM panics would be a good idea. I'm not sure now how we'd get the VM info and config in the panic handler, so perhaps now a feature would work so that we conditionally compile one of the available panic handlers.