Merge "Temporary hack: Boot protected VMs without pVM firmware."
diff --git a/authfs/Android.bp b/authfs/Android.bp
index ef78d4e..935ed5c 100644
--- a/authfs/Android.bp
+++ b/authfs/Android.bp
@@ -63,7 +63,7 @@
rust_test {
name: "authfs_device_test_src_lib",
defaults: ["authfs_defaults"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
data: [":authfs_test_files"],
}
diff --git a/compos/Android.bp b/compos/Android.bp
index 0bcbcdd..d4fccbb 100644
--- a/compos/Android.bp
+++ b/compos/Android.bp
@@ -49,5 +49,5 @@
rust_test {
name: "compsvc_device_tests",
defaults: ["compsvc_defaults"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
}
diff --git a/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java b/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java
index df3ad37..a49c9be 100644
--- a/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java
+++ b/javalib/src/android/system/virtualmachine/VirtualMachineCallback.java
@@ -60,11 +60,13 @@
@Retention(RetentionPolicy.SOURCE)
@IntDef({
DEATH_REASON_VIRTUALIZATIONSERVICE_DIED,
- DEATH_REASON_SHUTDOWN,
- DEATH_REASON_REBOOT,
+ DEATH_REASON_INFRASTRUCTURE_ERROR,
DEATH_REASON_KILLED,
DEATH_REASON_UNKNOWN,
- DEATH_REASON_INFRASTRUCTURE_ERROR
+ DEATH_REASON_SHUTDOWN,
+ DEATH_REASON_ERROR,
+ DEATH_REASON_REBOOT,
+ DEATH_REASON_CRASH
})
@interface DeathReason {}
@@ -74,20 +76,26 @@
*/
int DEATH_REASON_VIRTUALIZATIONSERVICE_DIED = -1;
- /** The VM requested to shut down. */
- int DEATH_REASON_SHUTDOWN = 0;
-
- /** The VM requested to reboot, possibly as the result of a kernel panic. */
- int DEATH_REASON_REBOOT = 1;
+ /** There was an error waiting for the VM. */
+ int DEATH_REASON_INFRASTRUCTURE_ERROR = 0;
/** The VM was killed. */
- int DEATH_REASON_KILLED = 2;
+ int DEATH_REASON_KILLED = 1;
/** The VM died for an unknown reason. */
- int DEATH_REASON_UNKNOWN = 3;
+ int DEATH_REASON_UNKNOWN = 2;
- /** There was an error waiting for the VM. */
- int DEATH_REASON_INFRASTRUCTURE_ERROR = 4;
+ /** The VM requested to shut down. */
+ int DEATH_REASON_SHUTDOWN = 3;
+
+ /** crosvm had an error starting the VM. */
+ int DEATH_REASON_ERROR = 4;
+
+ /** The VM requested to reboot, possibly as the result of a kernel panic. */
+ int DEATH_REASON_REBOOT = 5;
+
+ /** The VM or crosvm crashed. */
+ int DEATH_REASON_CRASH = 6;
/** Called when the payload starts in the VM. */
void onPayloadStarted(@NonNull VirtualMachine vm, @Nullable ParcelFileDescriptor stream);
diff --git a/javalib/src/android/system/virtualmachine/VirtualMachineConfig.java b/javalib/src/android/system/virtualmachine/VirtualMachineConfig.java
index 04a90e0..35d600a 100644
--- a/javalib/src/android/system/virtualmachine/VirtualMachineConfig.java
+++ b/javalib/src/android/system/virtualmachine/VirtualMachineConfig.java
@@ -206,6 +206,9 @@
// TODO(jiyong): should we treat APP_ONLY and FULL the same?
return false;
}
+ if (this.mProtectedVm != other.mProtectedVm) {
+ return false;
+ }
return true;
}
diff --git a/microdroid_manager/Android.bp b/microdroid_manager/Android.bp
index 1878c87..e4827aa 100644
--- a/microdroid_manager/Android.bp
+++ b/microdroid_manager/Android.bp
@@ -62,7 +62,7 @@
rust_test {
name: "microdroid_manager_test",
defaults: ["microdroid_manager_defaults"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
rustlibs: [
"libtempfile",
],
diff --git a/tests/Android.bp b/tests/Android.bp
index 0b3a821..cf720f1 100644
--- a/tests/Android.bp
+++ b/tests/Android.bp
@@ -23,7 +23,7 @@
cc_test {
name: "VirtualizationTestCases",
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
srcs: [
"common.cc",
"vsock_test.cc",
diff --git a/tests/aidl/Android.bp b/tests/aidl/Android.bp
index 893ec0b..a2315ce 100644
--- a/tests/aidl/Android.bp
+++ b/tests/aidl/Android.bp
@@ -9,7 +9,7 @@
backend: {
java: {
platform_apis: true,
- gen_rpc: true,
+ require_rpc: true,
},
cpp: {
enabled: true,
diff --git a/tests/hostside/Android.bp b/tests/hostside/Android.bp
index 968c991..d1318b5 100644
--- a/tests/hostside/Android.bp
+++ b/tests/hostside/Android.bp
@@ -5,7 +5,7 @@
java_test_host {
name: "MicrodroidHostTestCases",
srcs: ["java/**/*.java"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
libs: [
"tradefed",
],
diff --git a/tests/hostside/helper/Android.bp b/tests/hostside/helper/Android.bp
index 48dbcac..aa748ab 100644
--- a/tests/hostside/helper/Android.bp
+++ b/tests/hostside/helper/Android.bp
@@ -7,7 +7,7 @@
host_supported: true,
device_supported: false,
srcs: ["java/**/*.java"],
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
libs: [
"tradefed",
"compatibility-tradefed",
diff --git a/tests/testapk/Android.bp b/tests/testapk/Android.bp
index 40d72fe..7dca024 100644
--- a/tests/testapk/Android.bp
+++ b/tests/testapk/Android.bp
@@ -4,7 +4,7 @@
android_test {
name: "MicrodroidTestApp",
- test_suites: ["device-tests"],
+ test_suites: ["general-tests"],
srcs: ["src/java/**/*.java"],
static_libs: [
"androidx.test.runner",
diff --git a/virtualizationservice/aidl/android/system/virtualizationservice/DeathReason.aidl b/virtualizationservice/aidl/android/system/virtualizationservice/DeathReason.aidl
index 2f454a9..d736f1b 100644
--- a/virtualizationservice/aidl/android/system/virtualizationservice/DeathReason.aidl
+++ b/virtualizationservice/aidl/android/system/virtualizationservice/DeathReason.aidl
@@ -20,14 +20,18 @@
*/
@Backing(type="int")
enum DeathReason {
- /** The VM requested to shut down. */
- SHUTDOWN = 0,
- /** The VM requested to reboot, possibly as the result of a kernel panic. */
- REBOOT = 1,
- /** The VM was killed. */
- KILLED = 2,
- /** The VM died for an unknown reason. */
- UNKNOWN = 3,
/** There was an error waiting for the VM. */
- INFRASTRUCTURE_ERROR = 4,
+ INFRASTRUCTURE_ERROR = 0,
+ /** The VM was killed. */
+ KILLED = 1,
+ /** The VM died for an unknown reason. */
+ UNKNOWN = 2,
+ /** The VM requested to shut down. */
+ SHUTDOWN = 3,
+ /** crosvm had an error starting the VM. */
+ ERROR = 4,
+ /** The VM requested to reboot, possibly as the result of a kernel panic. */
+ REBOOT = 5,
+ /** The VM or crosvm crashed. */
+ CRASH = 6,
}
diff --git a/virtualizationservice/src/aidl.rs b/virtualizationservice/src/aidl.rs
index 5b0c9b7..ebb01b3 100644
--- a/virtualizationservice/src/aidl.rs
+++ b/virtualizationservice/src/aidl.rs
@@ -50,7 +50,7 @@
use binder_common::{lazy_service::LazyServiceGuard, new_binder_exception};
use disk::QcowFile;
use idsig::{HashAlgorithm, V4Signature};
-use log::{debug, error, info, warn};
+use log::{debug, error, info, warn, trace};
use microdroid_payload_config::VmPayloadConfig;
use rustutils::system_properties;
use statslog_virtualization_rust::vm_creation_requested::{stats_write, Hypervisor};
@@ -440,9 +440,9 @@
fn write_vm_creation_stats(protected: bool, success: bool) {
match stats_write(Hypervisor::Pkvm, protected, success) {
Err(e) => {
- info!("stastlog_rust fails with error: {}", e);
+ warn!("statslog_rust failed with error: {}", e);
}
- Ok(_) => info!("stastlog_rust succeeded for virtualization service"),
+ Ok(_) => trace!("statslog_rust succeeded for virtualization service"),
}
}
diff --git a/virtualizationservice/src/crosvm.rs b/virtualizationservice/src/crosvm.rs
index c02edab..352ed50 100644
--- a/virtualizationservice/src/crosvm.rs
+++ b/virtualizationservice/src/crosvm.rs
@@ -36,8 +36,12 @@
const CROSVM_PATH: &str = "/apex/com.android.virt/bin/crosvm";
+/// The exit status which crosvm returns when it has an error starting a VM.
+const CROSVM_ERROR_STATUS: i32 = 1;
/// The exit status which crosvm returns when a VM requests a reboot.
const CROSVM_REBOOT_STATUS: i32 = 32;
+/// The exit status which crosvm returns when it crashes due to an error.
+const CROSVM_CRASH_STATUS: i32 = 33;
/// Configuration for a VM to run with crosvm.
#[derive(Debug)]
@@ -243,7 +247,9 @@
match status.code() {
None => DeathReason::KILLED,
Some(0) => DeathReason::SHUTDOWN,
+ Some(CROSVM_ERROR_STATUS) => DeathReason::ERROR,
Some(CROSVM_REBOOT_STATUS) => DeathReason::REBOOT,
+ Some(CROSVM_CRASH_STATUS) => DeathReason::CRASH,
Some(_) => DeathReason::UNKNOWN,
}
} else {
diff --git a/vm/src/run.rs b/vm/src/run.rs
index d558add..6a0fc15 100644
--- a/vm/src/run.rs
+++ b/vm/src/run.rs
@@ -293,11 +293,13 @@
self.dead.raise();
match reason {
- DeathReason::SHUTDOWN => println!("VM shutdown cleanly."),
- DeathReason::REBOOT => println!("VM tried to reboot, possibly due to a kernel panic."),
+ DeathReason::INFRASTRUCTURE_ERROR => println!("Error waiting for VM to finish."),
DeathReason::KILLED => println!("VM was killed."),
DeathReason::UNKNOWN => println!("VM died for an unknown reason."),
- DeathReason::INFRASTRUCTURE_ERROR => println!("Error waiting for VM to finish."),
+ DeathReason::SHUTDOWN => println!("VM shutdown cleanly."),
+ DeathReason::ERROR => println!("Error starting VM."),
+ DeathReason::REBOOT => println!("VM tried to reboot, possibly due to a kernel panic."),
+ DeathReason::CRASH => println!("VM crashed."),
_ => println!("VM died for an unrecognised reason."),
}
Ok(())