platform_system_sepolicy/recovery.te
Stephen Smalley eb1bbf2632 Clean up kernel, init, and recovery domains.
Narrow the relabelto rules to a more specific type set
for each domain.

Drop mount permissions from the kernel domain since mounting
occurs after switching to the init domain.  This was likely
a residual of when all processes were left in the kernel domain
on a recovery boot due to the missing setcon statement in the
recovery init.rc.

Be consistent with unlabeled filesystems (i.e. filesystems
without any matching fs_use or genfs_contexts entry) so
that we can also unmount them.

Add comments to note the reason for various rules.

Change-Id: I269a1744ed7bf8c6be899494c5dc97847e5a994d
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-05-29 14:35:55 -04:00

25 lines
897 B
Text

# recovery console (used in recovery init.rc for /sbin/recovery)
type recovery, domain;
allow recovery rootfs:file entrypoint;
unconfined_domain(recovery)
allow recovery self:capability2 mac_admin;
# Mount filesystems.
allow recovery fs_type:filesystem *;
allow recovery unlabeled:filesystem *;
# Create and relabel files under /system.
allow recovery exec_type:{ file dir lnk_file } { create write setattr relabelfrom relabelto append unlink link rename };
allow recovery system_file:{ file dir lnk_file } { create write setattr relabelfrom relabelto append unlink link rename };
# Required to e.g. wipe userdata/cache.
allow recovery dev_type:blk_file rw_file_perms;
allow recovery self:process execmem;
allow recovery ashmem_device:chr_file execute;
allow recovery tmpfs:file rx_file_perms;
# Use setfscreatecon() to label files for OTA updates.
allow recovery self:process setfscreate;