blob: 9b82e018f203c7868246467940ba013e35b3e60e [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)
10
11# Let the virtualizationservice domain register the virtualization_service with ServiceManager.
12add_service(virtualizationservice, virtualization_service)
13
14# When virtualizationservice execs a file with the crosvm_exec label, run it in the crosvm domain.
15domain_auto_trans(virtualizationservice, crosvm_exec, crosvm)
16
17# Let virtualizationservice exec other files (e.g. mk_cdisk) in the same domain.
18allow virtualizationservice system_file:file execute_no_trans;
19
20# Let virtualizationservice kill crosvm.
21allow virtualizationservice crosvm:process sigkill;
22
23# Let virtualizationservice access its data directory.
24allow virtualizationservice virtualizationservice_data_file:file create_file_perms;
25allow virtualizationservice virtualizationservice_data_file:dir create_dir_perms;
Andrew Walbran9b2fa1b2021-07-01 15:58:26 +000026
27# virtualizationservice_use(client)
28define(`virtualizationservice_use', `
29# Let the client call virtualizationservice.
30binder_call($1, virtualizationservice)
31# Let the client pass file descriptors to virtualizationservice.
32allow virtualizationservice $1:fd use;
33')
34
35# Let the shell user call virtualizationservice for debugging.
36virtualizationservice_use(shell)
37
38# Let virtualizationservice read and write files from its various clients, but not open them
39# directly as they must be passed over Binder by the client.
40allow virtualizationservice apk_data_file:file { getattr read };
41allow virtualizationservice app_data_file:file { getattr read write };
42# shell_data_file is used for automated tests and manual debugging.
43allow virtualizationservice shell_data_file:file { getattr read write };