blob: 621b1a8225c243c65f0bcd46054a102c78ec42c2 [file] [log] [blame]
Inseob Kimff43be22021-06-07 16:56:56 +09001typeattribute apexd coredomain;
2
3init_daemon_domain(apexd)
4
Inseob Kimff43be22021-06-07 16:56:56 +09005# allow apexd to create loop devices with /dev/loop-control
6allow apexd loop_control_device:chr_file rw_file_perms;
7# allow apexd to access loop devices
8allow apexd loop_device:blk_file rw_file_perms;
9allowxperm apexd loop_device:blk_file ioctl {
10 LOOP_GET_STATUS64
11 LOOP_SET_STATUS64
12 LOOP_SET_FD
13 LOOP_SET_BLOCK_SIZE
14 LOOP_SET_DIRECT_IO
15 LOOP_CLR_FD
16 BLKFLSBUF
17 LOOP_CONFIGURE
18};
19# allow apexd to access /dev/block
20allow apexd block_device:dir r_dir_perms;
21
22#allow apexd to access virtual disks
23allow apexd vd_device:blk_file r_file_perms;
24
25# allow apexd to access /dev/block/dm-* (device-mapper entries)
26allow apexd dm_device:chr_file rw_file_perms;
27allow apexd dm_device:blk_file rw_file_perms;
28
29# sys_admin is required to access the device-mapper and mount
30# dac_override, chown, and fowner are needed for snapshot and restore
31allow apexd self:global_capability_class_set { sys_admin chown dac_override dac_read_search fowner };
32
33# Note: fsetid is deliberately not included above. fsetid checks are
34# triggered by chmod on a directory or file owned by a group other
35# than one of the groups assigned to the current process to see if
36# the setgid bit should be cleared, regardless of whether the setgid
37# bit was even set. We do not appear to truly need this capability
38# for apexd to operate.
39dontaudit apexd self:global_capability_class_set fsetid;
40
41# allow apexd to create a mount point in /apex
42allow apexd apex_mnt_dir:dir create_dir_perms;
43# allow apexd to mount in /apex
44allow apexd apex_mnt_dir:filesystem { mount unmount };
45allow apexd apex_mnt_dir:dir mounton;
46# allow apexd to create symlinks in /apex
47allow apexd apex_mnt_dir:lnk_file create_file_perms;
48# allow apexd to create /apex/apex-info-list.xml and relabel to apex_info_file
49allow apexd apex_mnt_dir:file { create_file_perms relabelfrom mounton };
50allow apexd apex_info_file:file relabelto;
Inseob Kim4eb56602021-07-09 15:51:12 +090051# apexd needs to update /apex/apex-info-list.xml after non-staged APEX update.
52allow apexd apex_info_file:file rw_file_perms;
Inseob Kimff43be22021-06-07 16:56:56 +090053
54# Unmount and mount filesystems
55allow apexd labeledfs:filesystem { mount unmount };
56
57# /sys directory tree traversal
58allow apexd sysfs_type:dir search;
59# Configure read-ahead of dm-verity and loop devices
60# for dm-X
61allow apexd sysfs_dm:dir r_dir_perms;
62allow apexd sysfs_dm:file rw_file_perms;
63# for loopX
64allow apexd sysfs_loop:dir r_dir_perms;
65allow apexd sysfs_loop:file rw_file_perms;
66
67# Allow apexd to log to the kernel.
68allow apexd kmsg_device:chr_file w_file_perms;
69
Inseob Kimff43be22021-06-07 16:56:56 +090070# Apex pre- & post-install permission.
71
72# Allow self-execute for the fork mount helper.
73allow apexd apexd_exec:file execute_no_trans;
74
75# Unshare and make / private so that hooks cannot influence the
76# running system.
77allow apexd rootfs:dir mounton;
78
Inseob Kimff43be22021-06-07 16:56:56 +090079# apexd is using bootstrap bionic
80allow apexd system_bootstrap_lib_file:dir r_dir_perms;
81allow apexd system_bootstrap_lib_file:file { execute read open getattr map };
82
Inseob Kim4eb56602021-07-09 15:51:12 +090083# Allow apexd to read file contexts when performing restorecon
Inseob Kimff43be22021-06-07 16:56:56 +090084allow apexd file_contexts_file:file r_file_perms;
85
Inseob Kim4eb56602021-07-09 15:51:12 +090086#-------------------------------------------
87allow apexd kmsg_device:chr_file w_file_perms;