2022-12-15 14:38:42 +01:00
|
|
|
# Domain for a child process that manages virtual machines on behalf of its parent.
|
|
|
|
|
|
|
|
type virtualizationmanager, domain, coredomain;
|
|
|
|
type virtualizationmanager_exec, system_file_type, exec_type, file_type;
|
|
|
|
|
|
|
|
# Allow virtualizationmanager to communicate use, read and write over the adb connection.
|
|
|
|
allow virtualizationmanager adbd:fd use;
|
2023-09-04 14:26:03 +02:00
|
|
|
allow virtualizationmanager adbd:unix_stream_socket { getattr read write };
|
2022-12-15 14:38:42 +01:00
|
|
|
|
2023-06-08 14:13:08 +02:00
|
|
|
# Allow writing VM logs to the shell console
|
|
|
|
allow virtualizationmanager devpts:chr_file { read write getattr ioctl };
|
|
|
|
|
2022-12-15 14:38:42 +01:00
|
|
|
# Let the virtualizationmanager domain use Binder.
|
|
|
|
binder_use(virtualizationmanager)
|
|
|
|
|
|
|
|
# Let virtualizationmanager find and communicate with virtualizationservice.
|
|
|
|
allow virtualizationmanager virtualization_service:service_manager find;
|
|
|
|
binder_call(virtualizationmanager, virtualizationservice)
|
|
|
|
|
|
|
|
# Allow calling into the system server to find native services. "permission_service" to check
|
|
|
|
# permissions, and "package_native" for staged apex info.
|
|
|
|
binder_call(virtualizationmanager, system_server)
|
|
|
|
allow virtualizationmanager { package_native_service permission_service }:service_manager find;
|
|
|
|
|
|
|
|
# When virtualizationmanager execs a file with the crosvm_exec label, run it in the crosvm domain.
|
|
|
|
domain_auto_trans(virtualizationmanager, crosvm_exec, crosvm)
|
|
|
|
|
|
|
|
# Let virtualizationmanager kill crosvm.
|
|
|
|
allow virtualizationmanager crosvm:process sigkill;
|
|
|
|
|
|
|
|
# Let virtualizationmanager create files inside virtualizationservice's temporary directories.
|
|
|
|
allow virtualizationmanager virtualizationservice_data_file:dir rw_dir_perms;
|
|
|
|
allow virtualizationmanager virtualizationservice_data_file:{ file sock_file } create_file_perms;
|
|
|
|
|
|
|
|
# Let virtualizationmanager read and write files from its various clients, but not open them
|
|
|
|
# directly as they must be passed over Binder by the client.
|
|
|
|
allow virtualizationmanager apk_data_file:file { getattr read };
|
|
|
|
|
|
|
|
# Write access is needed for mutable partitions like instance.img
|
|
|
|
allow virtualizationmanager {
|
|
|
|
app_data_file
|
|
|
|
apex_compos_data_file
|
2023-08-31 13:37:30 +02:00
|
|
|
apex_virt_data_file
|
2022-12-15 14:38:42 +01:00
|
|
|
privapp_data_file
|
|
|
|
}:file { getattr read write };
|
|
|
|
|
|
|
|
# shell_data_file is used for automated tests and manual debugging.
|
|
|
|
allow virtualizationmanager shell_data_file:file { getattr read write };
|
|
|
|
|
|
|
|
# Allow virtualizationmanager to read apex-info-list.xml and access the APEX files listed there.
|
|
|
|
allow virtualizationmanager apex_info_file:file r_file_perms;
|
|
|
|
allow virtualizationmanager apex_data_file:dir search;
|
|
|
|
allow virtualizationmanager staging_data_file:file r_file_perms;
|
|
|
|
allow virtualizationmanager staging_data_file:dir search;
|
|
|
|
|
|
|
|
# Run derive_classpath in our domain
|
|
|
|
allow virtualizationmanager derive_classpath_exec:file rx_file_perms;
|
|
|
|
allow virtualizationmanager apex_mnt_dir:dir r_dir_perms;
|
|
|
|
# Ignore harmless denials on /proc/self/fd
|
|
|
|
dontaudit virtualizationmanager self:dir write;
|
|
|
|
|
|
|
|
# Let virtualizationmanager to accept vsock connection from the guest VMs
|
|
|
|
allow virtualizationmanager self:vsock_socket { create_socket_perms_no_ioctl listen accept };
|
|
|
|
|
|
|
|
# Allow virtualizationmanager to inspect all hypervisor capabilities.
|
|
|
|
get_prop(virtualizationmanager, hypervisor_prop)
|
|
|
|
get_prop(virtualizationmanager, hypervisor_restricted_prop)
|
|
|
|
|
2023-08-31 09:58:08 +02:00
|
|
|
# Allow virtualizationmanager to be read custom pvmfw.img configuration
|
|
|
|
userdebug_or_eng(`get_prop(virtualizationmanager, hypervisor_pvmfw_prop)')
|
|
|
|
dontaudit virtualizationmanager hypervisor_pvmfw_prop:file read;
|
2023-09-01 08:00:45 +02:00
|
|
|
neverallow { domain -init -dumpstate userdebug_or_eng(`-virtualizationmanager') } hypervisor_pvmfw_prop:file no_rw_file_perms;
|
2023-08-31 09:58:08 +02:00
|
|
|
|
|
|
|
# Allow virtualizationmanager to be read custom virtualizationmanager configuration
|
|
|
|
userdebug_or_eng(`get_prop(virtualizationmanager, hypervisor_virtualizationmanager_prop)')
|
|
|
|
dontaudit virtualizationmanager hypervisor_virtualizationmanager_prop:file read;
|
2023-09-01 08:00:45 +02:00
|
|
|
neverallow { domain -init -dumpstate userdebug_or_eng(`-virtualizationmanager') } hypervisor_virtualizationmanager_prop:file no_rw_file_perms;
|
2023-08-31 09:58:08 +02:00
|
|
|
|
2022-12-15 14:38:42 +01:00
|
|
|
# Allow virtualizationmanager service to talk to tombstoned to push guest ramdumps
|
|
|
|
unix_socket_connect(virtualizationmanager, tombstoned_crash, tombstoned)
|
|
|
|
|
|
|
|
# Append ramdumps to tombstone files passed as fds from tombstoned
|
|
|
|
allow virtualizationmanager tombstone_data_file:file { append getattr };
|
|
|
|
allow virtualizationmanager tombstoned:fd use;
|
|
|
|
|
2023-04-03 05:57:25 +02:00
|
|
|
# Allow virtualizationmanager to read AVF debug policy
|
2023-02-06 17:49:24 +01:00
|
|
|
allow virtualizationmanager sysfs_dt_avf:dir search;
|
|
|
|
allow virtualizationmanager sysfs_dt_avf:file { open read };
|
|
|
|
|
2023-04-03 05:57:25 +02:00
|
|
|
# Let virtualizationmanager open test artifacts under /data/local/tmp with file path.
|
|
|
|
# (e.g. custom debug policy)
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow virtualizationmanager shell_data_file:dir search;
|
|
|
|
allow virtualizationmanager shell_data_file:file open;
|
|
|
|
')
|
|
|
|
|
2022-12-15 14:38:42 +01:00
|
|
|
# Allow reading files under /proc/[crosvm pid]/, for collecting CPU & memory usage inside VM.
|
|
|
|
r_dir_file(virtualizationmanager, crosvm);
|
2023-01-05 15:03:13 +01:00
|
|
|
|
|
|
|
# For debug purposes we try to get the canonical path from /proc/self/fd/N. That triggers
|
|
|
|
# a harmless denial for CompOS log files, so ignore that.
|
|
|
|
dontaudit virtualizationmanager apex_module_data_file:dir search;
|