Go to file
Jiyong Park 029977d760 Don't allow disk images labeled as app_data_file
At least for T, we don't want to have a VM that is running a disk image
that is not protected by AVB (Android Verified Boot). This means that
the disk images must be from file in the built-in partitions (like
system) or their updates (because updates are guaranteed to be from the
same signer).

This rule is currently being enforced by selinux policies around crosvm.
However, there is one exception. It has the following allow rule.

allow crosvm app_data_file:file { read ...};

app_data_file is for any file that is owned and dynamically created by
apps. They could be a file downloaded from Internet, and therefore is
definitely not protected by AVB. The only reason we have the above allow
rule is the instance image. The file is mutable because it has per-VM
identity information that is written when a pVM is first created. The
file is owned by the owning app, otherwise other apps would be able to
start the same VM. In other words, we don't intend to allow any
app_data_file to be loadable in a pVM. But such an intention can't be
expressed in sepolicy.

This CL augments the sepolicy by adding a runtime check in
virtualizationservice. Specifically, it rejects to spawn a VM if any of
the disk images is labeled as app_data_file, except for the disk image
for the instance partition.

Bug: 204852957
Test: adb shell chcon u:object_r:app_data_file:s0 /data/local/tmp/virt/MicrodroidDemoApp.apk
adb shell /apex/com.android.virt/bin/vm run-app --debug full \
/data/local/tmp/virt/MicrodroidDemoApp.apk \
/data/local/tmp/virt/MicrodroidDemoApp.apk.idsig \
/data/local/tmp/virt/instance.img assets/vm_config.json \

gives the following error as expected.

Status(-8, EX_SERVICE_SPECIFIC): '-1: Partition microdroid-apk shouldn't
be labeld as u:object_r:app_data_file:s0'

Change-Id: Ia7081b8ecb2db1ecc1f7d4941a305ccff6016f3e
2021-11-26 00:28:20 +09:00
apex Disable CompOS system server classpath fragment 2021-11-23 15:14:01 +00:00
apkdmverity Merge "Change the name of the dm device for the correct_custom_roothash test" 2021-09-14 13:03:19 +00:00
apkverify Store public key of APK to instance disk 2021-09-13 15:38:30 +09:00
authfs compsvc: run odrefresh in the VM 2021-11-22 09:23:15 -08:00
binder_common Re-implement libcompos_client in Rust 2021-10-21 09:58:02 -07:00
compos Merge "Add notifyError/onError notification for VM errors" 2021-11-24 00:58:11 +00:00
demo Add notifyError/onError notification for VM errors 2021-11-23 22:15:05 +09:00
docs/getting_started Update docs 2021-11-22 18:47:01 +09:00
idsig Add placeholder test to prevent CI failure. 2021-09-06 13:39:25 +00:00
javalib Add notifyError/onError notification for VM errors 2021-11-23 22:15:05 +09:00
launcher A lib in APK can depend on other libs in the same APK 2021-06-24 01:36:37 +09:00
libs/libavb_rs Store/Pass root digests of APEX payload 2021-09-13 18:32:21 +09:00
microdroid Merge "Update docs" 2021-11-22 11:17:09 +00:00
microdroid_manager Add notifyError/onError notification for VM errors 2021-11-23 22:15:05 +09:00
pvmfw Update bootloader, u-boot tools to builds 7889294 2021-11-08 14:17:34 +09:00
tests Add notifyError/onError notification for VM errors 2021-11-23 22:15:05 +09:00
virtualizationservice Don't allow disk images labeled as app_data_file 2021-11-26 00:28:20 +09:00
vm Add notifyError/onError notification for VM errors 2021-11-23 22:15:05 +09:00
vmconfig remove support of multi-file partition 2021-07-29 11:27:47 +09:00
zipfuse microdroid_manager: start zipfuse early 2021-09-10 15:27:06 +09:00
.clang-format Set an initial .clang-format style 2020-10-19 14:55:06 +01:00
Android.bp [LSC] Add LOCAL_LICENSE_KINDS to packages/modules/Virtualization 2021-06-14 16:37:09 -07:00
OWNERS Add OWNERS. 2021-06-21 17:04:15 +01:00
PREUPLOAD.cfg Remove google-java-format hook 2021-11-23 11:39:53 +00:00
README.md Add README at top of repository with links to others. 2021-06-30 16:22:17 +00:00
TEST_MAPPING Don't wait for onDied 2021-11-04 12:52:08 +09:00
rustfmt.toml

README.md

Virtualization

This repository contains userspace services related to running virtual machines on Android, especially protected virtual machines. See the getting started documentation and Microdroid README for more information.