Handle errors and crashes in VM differently to clean shutdown.

BUG=b:211704107
TEST=tools/dev_container tools/run_tests
TEST=tools/dev_container tools/run_tests --target=vm:aarch64

Change-Id: I383be89becefe300d9dc94b7d67d35269c628a39
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3412772
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Auto-Submit: Andrew Walbran <qwandor@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Andrew Walbran <qwandor@google.com>
diff --git a/src/main.rs b/src/main.rs
index ef1b93b..3040dd6 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2450,6 +2450,7 @@
     Success,
     VmReset,
     VmStop,
+    VmCrash,
 }
 
 fn run_vm(args: std::env::Args) -> std::result::Result<CommandStatus, ()> {
@@ -2740,6 +2741,10 @@
                 info!("crosvm has exited normally due to reset request");
                 Ok(CommandStatus::VmReset)
             }
+            Ok(platform::ExitState::Crash) => {
+                info!("crosvm has exited due to a VM crash");
+                Ok(CommandStatus::VmCrash)
+            }
             Err(e) => {
                 error!("crosvm has exited with error: {:#}", e);
                 Err(())
@@ -3395,6 +3400,7 @@
     let exit_code = match crosvm_main() {
         Ok(CommandStatus::Success | CommandStatus::VmStop) => 0,
         Ok(CommandStatus::VmReset) => 32,
+        Ok(CommandStatus::VmCrash) => 33,
         Err(_) => 1,
     };
     std::process::exit(exit_code);