blob: c92217de97e1b36f0031d670d8905be02af7f1fb [file] [log] [blame]
Yifan Hongf3753372019-09-20 15:14:23 -07001type snapshotctl, domain, coredomain;
2type snapshotctl_exec, system_file_type, exec_type, file_type;
3
4# Allow init to run snapshotctl and do auto domain transfer.
5init_daemon_domain(snapshotctl);
6
7# Allow to start gsid service.
8set_prop(snapshotctl, ctl_gsid_prop)
9
10# Allow to talk to gsid.
11binder_use(snapshotctl)
12allow snapshotctl gsi_service:service_manager find;
13binder_call(snapshotctl, gsid)
14
Yifan Hong070d3592019-11-01 11:55:51 -070015# Allow to create/read/write/delete OTA metadata files for snapshot status and COW file status.
Yifan Hongf3753372019-09-20 15:14:23 -070016allow snapshotctl metadata_file:dir search;
17allow snapshotctl ota_metadata_file:dir rw_dir_perms;
Yifan Hong070d3592019-11-01 11:55:51 -070018allow snapshotctl ota_metadata_file:file create_file_perms;
Yifan Hongf3753372019-09-20 15:14:23 -070019
20# Allow to get A/B slot suffix from device tree or kernel cmdline.
21r_dir_file(snapshotctl, sysfs_dt_firmware_android);
22allow snapshotctl proc_cmdline:file r_file_perms;
23
24# Needed to (re-)map logical partitions.
25allow snapshotctl block_device:dir r_dir_perms;
26allow snapshotctl super_block_device:blk_file r_file_perms;
27
28# Interact with device-mapper to collapse snapshots.
29allow snapshotctl dm_device:chr_file rw_file_perms;
30
31# Needed to mutate device-mapper nodes.
32allow snapshotctl self:global_capability_class_set sys_admin;
Yifan Hong667b7102019-11-07 14:48:48 -080033
34# Snapshotctl talk to boot control HAL to set merge status.
35hwbinder_use(snapshotctl)
36hal_client_domain(snapshotctl, hal_bootctl)
Yifan Hong589bb6f2020-02-03 17:01:49 -080037
Alessio Balsini59cfa122020-01-22 14:00:51 +000038# Allow snapshotctl to write to statsd socket.
39unix_socket_send(snapshotctl, statsdw, statsd)
40
Yifan Hong589bb6f2020-02-03 17:01:49 -080041# Logging
Yifan Hongb6b35b72020-02-04 17:07:34 -080042userdebug_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')
Jiakai Zhangb9cf68a2024-03-08 18:36:03 +000046
47# Allow to read /proc/bootconfig.
48allow snapshotctl proc_bootconfig:file r_file_perms;
49
50# Allow to control snapuserd.
51set_prop(snapshotctl, ctl_snapuserd_prop)
52
53# Allow to read snapuserd.* properties.
54get_prop(snapshotctl, snapuserd_prop)
55
56# Allow to talk to snapuserd.
57allow snapshotctl snapuserd_socket:sock_file write;
58allow snapshotctl snapuserd:unix_stream_socket { connectto };
59
60# Allow to read /dev/block/dm-* (device-mapper) nodes.
61allow snapshotctl dm_device:blk_file r_file_perms;
62
63# Allow to read dm-user control nodes.
64allow snapshotctl dm_user_device:dir search;