Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 1 | typeattribute otapreopt_chroot coredomain; |
| 2 | |
Roland Levillain | 9f28f8b | 2019-01-22 17:56:05 +0000 | [diff] [blame] | 3 | # Allow to transition to postinstall_dexopt, to run otapreopt in its own sandbox. |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 4 | domain_auto_trans(otapreopt_chroot, postinstall_file, postinstall_dexopt) |
Roland Levillain | 0a6c2d0 | 2019-01-15 17:36:47 +0000 | [diff] [blame] | 5 | |
| 6 | # Allow otapreopt_chroot to create loop devices with /dev/loop-control. |
| 7 | allow otapreopt_chroot loop_control_device:chr_file rw_file_perms; |
| 8 | # Allow otapreopt_chroot to access loop devices. |
| 9 | allow otapreopt_chroot loop_device:blk_file rw_file_perms; |
| 10 | allowxperm 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. |
| 21 | allow otapreopt_chroot sysfs_loop:dir r_dir_perms; |
| 22 | allow otapreopt_chroot sysfs_loop:file rw_file_perms; |
| 23 | |
| 24 | # Allow otapreopt_chroot to mount a tmpfs filesystem in /postinstall/apex. |
| 25 | allow otapreopt_chroot tmpfs:filesystem mount; |
Roland Levillain | a42ebf4 | 2019-01-24 14:32:17 +0000 | [diff] [blame^] | 26 | # Allow otapreopt_chroot to restore the security context of /postinstall/apex. |
| 27 | allow otapreopt_chroot tmpfs:dir relabelfrom; |
| 28 | allow otapreopt_chroot postinstall_apex_mnt_dir:dir relabelto; |
| 29 | |
| 30 | # Allow otapreopt_chroot to manipulate directory /postinstall/apex. |
| 31 | allow otapreopt_chroot postinstall_apex_mnt_dir:dir create_dir_perms; |
Roland Levillain | 0a6c2d0 | 2019-01-15 17:36:47 +0000 | [diff] [blame] | 32 | # Allow otapreopt_chroot to mount APEX packages in /postinstall/apex. |
Roland Levillain | a42ebf4 | 2019-01-24 14:32:17 +0000 | [diff] [blame^] | 33 | allow otapreopt_chroot postinstall_apex_mnt_dir:dir mounton; |
Roland Levillain | 7094d4f | 2019-01-21 15:01:26 +0000 | [diff] [blame] | 34 | |
Roland Levillain | 66fcb98 | 2019-01-25 12:59:47 +0000 | [diff] [blame] | 35 | # Allow otapreopt_chroot to access /dev/block (needed to detach loop |
| 36 | # devices used by ext4 images from APEX packages). |
Roland Levillain | 7094d4f | 2019-01-21 15:01:26 +0000 | [diff] [blame] | 37 | allow otapreopt_chroot block_device:dir r_dir_perms; |