blob: 68dc8bc39a455f29cfc5b693fa117adc3caae91c [file] [log] [blame]
David Brazdil55d808c2022-12-15 13:38:42 +00001# Domain for a child process that manages virtual machines on behalf of its parent.
2
3type virtualizationmanager, domain, coredomain;
4type virtualizationmanager_exec, system_file_type, exec_type, file_type;
5
6# Allow virtualizationmanager to communicate use, read and write over the adb connection.
7allow virtualizationmanager adbd:fd use;
8allow virtualizationmanager adbd:unix_stream_socket { read write };
9
Alan Stokes6d019be2023-06-08 13:13:08 +010010# Allow writing VM logs to the shell console
11allow virtualizationmanager devpts:chr_file { read write getattr ioctl };
12
David Brazdil55d808c2022-12-15 13:38:42 +000013# Let the virtualizationmanager domain use Binder.
14binder_use(virtualizationmanager)
15
16# Let virtualizationmanager find and communicate with virtualizationservice.
17allow virtualizationmanager virtualization_service:service_manager find;
18binder_call(virtualizationmanager, virtualizationservice)
19
20# Allow calling into the system server to find native services. "permission_service" to check
21# permissions, and "package_native" for staged apex info.
22binder_call(virtualizationmanager, system_server)
23allow virtualizationmanager { package_native_service permission_service }:service_manager find;
24
25# When virtualizationmanager execs a file with the crosvm_exec label, run it in the crosvm domain.
26domain_auto_trans(virtualizationmanager, crosvm_exec, crosvm)
27
28# Let virtualizationmanager kill crosvm.
29allow virtualizationmanager crosvm:process sigkill;
30
31# Let virtualizationmanager create files inside virtualizationservice's temporary directories.
32allow virtualizationmanager virtualizationservice_data_file:dir rw_dir_perms;
33allow virtualizationmanager virtualizationservice_data_file:{ file sock_file } create_file_perms;
34
35# Let virtualizationmanager read and write files from its various clients, but not open them
36# directly as they must be passed over Binder by the client.
37allow virtualizationmanager apk_data_file:file { getattr read };
38
39# Write access is needed for mutable partitions like instance.img
40allow virtualizationmanager {
41 app_data_file
42 apex_compos_data_file
43 privapp_data_file
44}:file { getattr read write };
45
46# shell_data_file is used for automated tests and manual debugging.
47allow virtualizationmanager shell_data_file:file { getattr read write };
48
49# Allow virtualizationmanager to read apex-info-list.xml and access the APEX files listed there.
50allow virtualizationmanager apex_info_file:file r_file_perms;
51allow virtualizationmanager apex_data_file:dir search;
52allow virtualizationmanager staging_data_file:file r_file_perms;
53allow virtualizationmanager staging_data_file:dir search;
54
55# Run derive_classpath in our domain
56allow virtualizationmanager derive_classpath_exec:file rx_file_perms;
57allow virtualizationmanager apex_mnt_dir:dir r_dir_perms;
58# Ignore harmless denials on /proc/self/fd
59dontaudit virtualizationmanager self:dir write;
60
61# Let virtualizationmanager to accept vsock connection from the guest VMs
62allow virtualizationmanager self:vsock_socket { create_socket_perms_no_ioctl listen accept };
63
64# Allow virtualizationmanager to inspect all hypervisor capabilities.
65get_prop(virtualizationmanager, hypervisor_prop)
66get_prop(virtualizationmanager, hypervisor_restricted_prop)
67
Jaewan Kim4183cbb2023-08-31 07:58:08 +000068# Allow virtualizationmanager to be read custom pvmfw.img configuration
69userdebug_or_eng(`get_prop(virtualizationmanager, hypervisor_pvmfw_prop)')
70dontaudit virtualizationmanager hypervisor_pvmfw_prop:file read;
Jaewan Kim796ec5f2023-09-01 06:00:45 +000071neverallow { domain -init -dumpstate userdebug_or_eng(`-virtualizationmanager') } hypervisor_pvmfw_prop:file no_rw_file_perms;
Jaewan Kim4183cbb2023-08-31 07:58:08 +000072
73# Allow virtualizationmanager to be read custom virtualizationmanager configuration
74userdebug_or_eng(`get_prop(virtualizationmanager, hypervisor_virtualizationmanager_prop)')
75dontaudit virtualizationmanager hypervisor_virtualizationmanager_prop:file read;
Jaewan Kim796ec5f2023-09-01 06:00:45 +000076neverallow { domain -init -dumpstate userdebug_or_eng(`-virtualizationmanager') } hypervisor_virtualizationmanager_prop:file no_rw_file_perms;
Jaewan Kim4183cbb2023-08-31 07:58:08 +000077
David Brazdil55d808c2022-12-15 13:38:42 +000078# Allow virtualizationmanager service to talk to tombstoned to push guest ramdumps
79unix_socket_connect(virtualizationmanager, tombstoned_crash, tombstoned)
80
81# Append ramdumps to tombstone files passed as fds from tombstoned
82allow virtualizationmanager tombstone_data_file:file { append getattr };
83allow virtualizationmanager tombstoned:fd use;
84
Jaewan Kim0783a9c2023-04-03 12:57:25 +090085# Allow virtualizationmanager to read AVF debug policy
Jaewan Kim93f57882023-02-07 01:49:24 +090086allow virtualizationmanager sysfs_dt_avf:dir search;
87allow virtualizationmanager sysfs_dt_avf:file { open read };
88
Jaewan Kim0783a9c2023-04-03 12:57:25 +090089# Let virtualizationmanager open test artifacts under /data/local/tmp with file path.
90# (e.g. custom debug policy)
91userdebug_or_eng(`
92 allow virtualizationmanager shell_data_file:dir search;
93 allow virtualizationmanager shell_data_file:file open;
94')
95
David Brazdil55d808c2022-12-15 13:38:42 +000096# Allow reading files under /proc/[crosvm pid]/, for collecting CPU & memory usage inside VM.
97r_dir_file(virtualizationmanager, crosvm);
Alan Stokesc5b91462023-01-05 14:03:13 +000098
99# For debug purposes we try to get the canonical path from /proc/self/fd/N. That triggers
100# a harmless denial for CompOS log files, so ignore that.
101dontaudit virtualizationmanager apex_module_data_file:dir search;