Yifan Hong | f375337 | 2019-09-20 15:14:23 -0700 | [diff] [blame] | 1 | type snapshotctl, domain, coredomain; |
| 2 | type snapshotctl_exec, system_file_type, exec_type, file_type; |
| 3 | |
| 4 | # Allow init to run snapshotctl and do auto domain transfer. |
| 5 | init_daemon_domain(snapshotctl); |
| 6 | |
| 7 | # Allow to start gsid service. |
| 8 | set_prop(snapshotctl, ctl_gsid_prop) |
| 9 | |
| 10 | # Allow to talk to gsid. |
| 11 | binder_use(snapshotctl) |
| 12 | allow snapshotctl gsi_service:service_manager find; |
| 13 | binder_call(snapshotctl, gsid) |
| 14 | |
Yifan Hong | 070d359 | 2019-11-01 11:55:51 -0700 | [diff] [blame] | 15 | # Allow to create/read/write/delete OTA metadata files for snapshot status and COW file status. |
Yifan Hong | f375337 | 2019-09-20 15:14:23 -0700 | [diff] [blame] | 16 | allow snapshotctl metadata_file:dir search; |
| 17 | allow snapshotctl ota_metadata_file:dir rw_dir_perms; |
Yifan Hong | 070d359 | 2019-11-01 11:55:51 -0700 | [diff] [blame] | 18 | allow snapshotctl ota_metadata_file:file create_file_perms; |
Yifan Hong | f375337 | 2019-09-20 15:14:23 -0700 | [diff] [blame] | 19 | |
| 20 | # Allow to get A/B slot suffix from device tree or kernel cmdline. |
| 21 | r_dir_file(snapshotctl, sysfs_dt_firmware_android); |
| 22 | allow snapshotctl proc_cmdline:file r_file_perms; |
| 23 | |
| 24 | # Needed to (re-)map logical partitions. |
| 25 | allow snapshotctl block_device:dir r_dir_perms; |
| 26 | allow snapshotctl super_block_device:blk_file r_file_perms; |
| 27 | |
| 28 | # Interact with device-mapper to collapse snapshots. |
| 29 | allow snapshotctl dm_device:chr_file rw_file_perms; |
| 30 | |
| 31 | # Needed to mutate device-mapper nodes. |
| 32 | allow snapshotctl self:global_capability_class_set sys_admin; |
Yifan Hong | 667b710 | 2019-11-07 14:48:48 -0800 | [diff] [blame] | 33 | |
| 34 | # Snapshotctl talk to boot control HAL to set merge status. |
| 35 | hwbinder_use(snapshotctl) |
| 36 | hal_client_domain(snapshotctl, hal_bootctl) |
Yifan Hong | 589bb6f | 2020-02-03 17:01:49 -0800 | [diff] [blame] | 37 | |
Alessio Balsini | 59cfa12 | 2020-01-22 14:00:51 +0000 | [diff] [blame^] | 38 | # Allow snapshotctl to write to statsd socket. |
| 39 | unix_socket_send(snapshotctl, statsdw, statsd) |
| 40 | |
Yifan Hong | 589bb6f | 2020-02-03 17:01:49 -0800 | [diff] [blame] | 41 | # Logging |
Yifan Hong | b6b35b7 | 2020-02-04 17:07:34 -0800 | [diff] [blame] | 42 | userdebug_or_eng(` |
| 43 | allow snapshotctl snapshotctl_log_data_file:dir rw_dir_perms; |
| 44 | allow snapshotctl snapshotctl_log_data_file:file create_file_perms; |
| 45 | ') |