Andrew Walbran | 4b80a3f | 2021-05-21 13:21:43 +0000 | [diff] [blame] | 1 | type virtualizationservice, domain, coredomain; |
| 2 | type 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. |
| 6 | init_daemon_domain(virtualizationservice) |
| 7 | |
| 8 | # Let the virtualizationservice domain use Binder. |
| 9 | binder_use(virtualizationservice) |
| 10 | |
| 11 | # Let the virtualizationservice domain register the virtualization_service with ServiceManager. |
| 12 | add_service(virtualizationservice, virtualization_service) |
| 13 | |
| 14 | # When virtualizationservice execs a file with the crosvm_exec label, run it in the crosvm domain. |
| 15 | domain_auto_trans(virtualizationservice, crosvm_exec, crosvm) |
| 16 | |
| 17 | # Let virtualizationservice exec other files (e.g. mk_cdisk) in the same domain. |
| 18 | allow virtualizationservice system_file:file execute_no_trans; |
| 19 | |
| 20 | # Let virtualizationservice kill crosvm. |
| 21 | allow virtualizationservice crosvm:process sigkill; |
| 22 | |
| 23 | # Let virtualizationservice access its data directory. |
| 24 | allow virtualizationservice virtualizationservice_data_file:file create_file_perms; |
| 25 | allow virtualizationservice virtualizationservice_data_file:dir create_dir_perms; |
Andrew Walbran | 9b2fa1b | 2021-07-01 15:58:26 +0000 | [diff] [blame^] | 26 | |
| 27 | # virtualizationservice_use(client) |
| 28 | define(`virtualizationservice_use', ` |
| 29 | # Let the client call virtualizationservice. |
| 30 | binder_call($1, virtualizationservice) |
| 31 | # Let the client pass file descriptors to virtualizationservice. |
| 32 | allow virtualizationservice $1:fd use; |
| 33 | ') |
| 34 | |
| 35 | # Let the shell user call virtualizationservice for debugging. |
| 36 | virtualizationservice_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. |
| 40 | allow virtualizationservice apk_data_file:file { getattr read }; |
| 41 | allow virtualizationservice app_data_file:file { getattr read write }; |
| 42 | # shell_data_file is used for automated tests and manual debugging. |
| 43 | allow virtualizationservice shell_data_file:file { getattr read write }; |