2019-09-21 00:14:23 +02:00
|
|
|
type snapshotctl, domain, coredomain;
|
|
|
|
type snapshotctl_exec, system_file_type, exec_type, file_type;
|
|
|
|
|
|
|
|
# Allow init to run snapshotctl and do auto domain transfer.
|
|
|
|
init_daemon_domain(snapshotctl);
|
|
|
|
|
|
|
|
# Allow to start gsid service.
|
|
|
|
set_prop(snapshotctl, ctl_gsid_prop)
|
|
|
|
|
|
|
|
# Allow to talk to gsid.
|
|
|
|
binder_use(snapshotctl)
|
|
|
|
allow snapshotctl gsi_service:service_manager find;
|
|
|
|
binder_call(snapshotctl, gsid)
|
|
|
|
|
2019-11-01 19:55:51 +01:00
|
|
|
# Allow to create/read/write/delete OTA metadata files for snapshot status and COW file status.
|
2019-09-21 00:14:23 +02:00
|
|
|
allow snapshotctl metadata_file:dir search;
|
|
|
|
allow snapshotctl ota_metadata_file:dir rw_dir_perms;
|
2019-11-01 19:55:51 +01:00
|
|
|
allow snapshotctl ota_metadata_file:file create_file_perms;
|
2019-09-21 00:14:23 +02:00
|
|
|
|
|
|
|
# Allow to get A/B slot suffix from device tree or kernel cmdline.
|
|
|
|
r_dir_file(snapshotctl, sysfs_dt_firmware_android);
|
|
|
|
allow snapshotctl proc_cmdline:file r_file_perms;
|
|
|
|
|
|
|
|
# Needed to (re-)map logical partitions.
|
|
|
|
allow snapshotctl block_device:dir r_dir_perms;
|
|
|
|
allow snapshotctl super_block_device:blk_file r_file_perms;
|
|
|
|
|
|
|
|
# Interact with device-mapper to collapse snapshots.
|
|
|
|
allow snapshotctl dm_device:chr_file rw_file_perms;
|
|
|
|
|
|
|
|
# Needed to mutate device-mapper nodes.
|
|
|
|
allow snapshotctl self:global_capability_class_set sys_admin;
|
2019-11-07 23:48:48 +01:00
|
|
|
|
|
|
|
# Snapshotctl talk to boot control HAL to set merge status.
|
|
|
|
hwbinder_use(snapshotctl)
|
|
|
|
hal_client_domain(snapshotctl, hal_bootctl)
|
2020-02-04 02:01:49 +01:00
|
|
|
|
2020-01-22 15:00:51 +01:00
|
|
|
# Allow snapshotctl to write to statsd socket.
|
|
|
|
unix_socket_send(snapshotctl, statsdw, statsd)
|
|
|
|
|
2020-02-04 02:01:49 +01:00
|
|
|
# Logging
|
2020-02-05 02:07:34 +01:00
|
|
|
userdebug_or_eng(`
|
|
|
|
allow snapshotctl snapshotctl_log_data_file:dir rw_dir_perms;
|
|
|
|
allow snapshotctl snapshotctl_log_data_file:file create_file_perms;
|
|
|
|
')
|
2024-03-08 19:36:03 +01:00
|
|
|
|
|
|
|
# Allow to read /proc/bootconfig.
|
|
|
|
allow snapshotctl proc_bootconfig:file r_file_perms;
|
|
|
|
|
|
|
|
# Allow to control snapuserd.
|
|
|
|
set_prop(snapshotctl, ctl_snapuserd_prop)
|
|
|
|
|
|
|
|
# Allow to read snapuserd.* properties.
|
|
|
|
get_prop(snapshotctl, snapuserd_prop)
|
|
|
|
|
|
|
|
# Allow to talk to snapuserd.
|
|
|
|
allow snapshotctl snapuserd_socket:sock_file write;
|
|
|
|
allow snapshotctl snapuserd:unix_stream_socket { connectto };
|
|
|
|
|
|
|
|
# Allow to read /dev/block/dm-* (device-mapper) nodes.
|
|
|
|
allow snapshotctl dm_device:blk_file r_file_perms;
|
|
|
|
|
|
|
|
# Allow to read dm-user control nodes.
|
|
|
|
allow snapshotctl dm_user_device:dir search;
|