blob: aea2faaa00f718d31508ecb8da9dbba19649142b [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute otapreopt_chroot coredomain;
2
Roland Levillain9f28f8b2019-01-22 17:56:05 +00003# Allow to transition to postinstall_dexopt, to run otapreopt in its own sandbox.
dcashmancc39f632016-07-22 13:13:11 -07004domain_auto_trans(otapreopt_chroot, postinstall_file, postinstall_dexopt)
Roland Levillain0a6c2d02019-01-15 17:36:47 +00005
6# Allow otapreopt_chroot to create loop devices with /dev/loop-control.
7allow otapreopt_chroot loop_control_device:chr_file rw_file_perms;
8# Allow otapreopt_chroot to access loop devices.
9allow otapreopt_chroot loop_device:blk_file rw_file_perms;
10allowxperm otapreopt_chroot loop_device:blk_file ioctl {
11 LOOP_GET_STATUS64
12 LOOP_SET_STATUS64
13 LOOP_SET_FD
14 LOOP_SET_BLOCK_SIZE
15 LOOP_SET_DIRECT_IO
16 LOOP_CLR_FD
17 BLKFLSBUF
18};
19
20# Allow otapreopt_chroot to configure read-ahead of loop devices.
21allow otapreopt_chroot sysfs_loop:dir r_dir_perms;
22allow otapreopt_chroot sysfs_loop:file rw_file_perms;
23
24# Allow otapreopt_chroot to mount a tmpfs filesystem in /postinstall/apex.
25allow otapreopt_chroot tmpfs:filesystem mount;
Roland Levillaina42ebf42019-01-24 14:32:17 +000026# Allow otapreopt_chroot to restore the security context of /postinstall/apex.
27allow otapreopt_chroot tmpfs:dir relabelfrom;
28allow otapreopt_chroot postinstall_apex_mnt_dir:dir relabelto;
29
30# Allow otapreopt_chroot to manipulate directory /postinstall/apex.
31allow otapreopt_chroot postinstall_apex_mnt_dir:dir create_dir_perms;
Roland Levillain0a6c2d02019-01-15 17:36:47 +000032# Allow otapreopt_chroot to mount APEX packages in /postinstall/apex.
Roland Levillaina42ebf42019-01-24 14:32:17 +000033allow otapreopt_chroot postinstall_apex_mnt_dir:dir mounton;
Roland Levillain7094d4f2019-01-21 15:01:26 +000034
Roland Levillain66fcb982019-01-25 12:59:47 +000035# Allow otapreopt_chroot to access /dev/block (needed to detach loop
36# devices used by ext4 images from APEX packages).
Roland Levillain7094d4f2019-01-21 15:01:26 +000037allow otapreopt_chroot block_device:dir r_dir_perms;