blob: f92c94f1bbb469bbc7e6b5855e23f889a6135e99 [file] [log] [blame]
Andrew Walbran4b80a3f2021-05-21 13:21:43 +00001type virtualizationservice, domain, coredomain;
2type virtualizationservice_exec, system_file_type, exec_type, file_type;
3
4# When init runs a file labelled with virtualizationservice_exec, run it in the
5# virtualizationservice domain.
6init_daemon_domain(virtualizationservice)
7
8# Let the virtualizationservice domain use Binder.
9binder_use(virtualizationservice)
Jiyong Park5e20d832021-07-12 21:11:33 +090010# ... and host a binder service
11binder_service(virtualizationservice)
12# It needs to call back to app
13binder_call(virtualizationservice, appdomain)
14
15# Allow calling into the system server so that it can check permissions.
16binder_call(virtualizationservice, system_server)
17allow virtualizationservice permission_service:service_manager find;
Andrew Walbran4b80a3f2021-05-21 13:21:43 +000018
19# Let the virtualizationservice domain register the virtualization_service with ServiceManager.
20add_service(virtualizationservice, virtualization_service)
21
22# When virtualizationservice execs a file with the crosvm_exec label, run it in the crosvm domain.
23domain_auto_trans(virtualizationservice, crosvm_exec, crosvm)
24
25# Let virtualizationservice exec other files (e.g. mk_cdisk) in the same domain.
26allow virtualizationservice system_file:file execute_no_trans;
27
28# Let virtualizationservice kill crosvm.
29allow virtualizationservice crosvm:process sigkill;
30
31# Let virtualizationservice access its data directory.
32allow virtualizationservice virtualizationservice_data_file:file create_file_perms;
33allow virtualizationservice virtualizationservice_data_file:dir create_dir_perms;
Andrew Walbran9b2fa1b2021-07-01 15:58:26 +000034
35# virtualizationservice_use(client)
36define(`virtualizationservice_use', `
37# Let the client call virtualizationservice.
38binder_call($1, virtualizationservice)
39# Let the client pass file descriptors to virtualizationservice.
40allow virtualizationservice $1:fd use;
41')
42
Jiyong Park5e20d832021-07-12 21:11:33 +090043# Let the shell user call virtualizationservice (and virtualizationservice call back to shell) for
44# debugging.
Andrew Walbran9b2fa1b2021-07-01 15:58:26 +000045virtualizationservice_use(shell)
Jiyong Park5e20d832021-07-12 21:11:33 +090046binder_call(virtualizationservice, shell)
47
48# Allow to use fd (e.g. /dev/pts/0) inherited from adbd so that we can redirect output from
49# crosvm to the console
50allow virtualizationservice adbd:fd use;
51allow virtualizationservice adbd:unix_stream_socket { read write };
Andrew Walbran9b2fa1b2021-07-01 15:58:26 +000052
53# Let virtualizationservice read and write files from its various clients, but not open them
54# directly as they must be passed over Binder by the client.
55allow virtualizationservice apk_data_file:file { getattr read };
Jiyong Park5e20d832021-07-12 21:11:33 +090056# Write access is needed for mutable partitions like instance.img
Alan Stokese2a002c2021-07-28 14:05:25 +010057allow virtualizationservice {
58 app_data_file
59 apex_compos_data_file
60}:file { getattr read write };
61
Andrew Walbran9b2fa1b2021-07-01 15:58:26 +000062# shell_data_file is used for automated tests and manual debugging.
63allow virtualizationservice shell_data_file:file { getattr read write };
Jiyong Parkf4083712021-07-10 14:35:06 +090064
Jiyong Park5e20d832021-07-12 21:11:33 +090065# Allow virtualizationservice to read apex-info-list.xml and access the APEX files listed there.
66allow virtualizationservice apex_info_file:file r_file_perms;
Jooyung Han6d4179a2021-07-16 13:05:40 +090067allow virtualizationservice apex_data_file:dir search;
68allow virtualizationservice staging_data_file:file r_file_perms;
69
Jiyong Parkf4083712021-07-10 14:35:06 +090070# Let virtualizationservice to accept vsock connection from the guest VMs
71allow virtualizationservice self:vsock_socket { create_socket_perms_no_ioctl listen accept };