blob: 8c1aaf361e0c94b0d499ce01c4fab3a799211395 [file] [log] [blame]
Jeff Sharkey5a5b3642015-03-31 08:04:46 -07001# Any fsck program run by init
Stephen Smalley8a0c25e2014-09-23 09:11:30 -04002type fsck, domain;
3type fsck_exec, exec_type, file_type;
Stephen Smalley8a0c25e2014-09-23 09:11:30 -04004
5init_daemon_domain(fsck)
6
7# /dev/__null__ created by init prior to policy load,
8# open fd inherited by fsck.
9allow fsck tmpfs:chr_file { read write ioctl };
10
11# Inherit and use pty created by android_fork_execvp_ext().
Nick Kralevich57a17d12014-10-20 10:36:49 -070012allow fsck devpts:chr_file { read write ioctl getattr };
Stephen Smalley8a0c25e2014-09-23 09:11:30 -040013
Jeff Sharkey84e1c612015-04-01 10:15:51 -070014# Allow stdin/out back to vold
15allow fsck vold:fd use;
16allow fsck vold:fifo_file { read write getattr };
17
Jeff Sharkeyf063f462015-03-27 11:25:39 -070018# Run fsck on certain block devices
Stephen Smalley509186d2015-02-10 16:13:45 -050019allow fsck block_device:dir search;
Stephen Smalley8a0c25e2014-09-23 09:11:30 -040020allow fsck userdata_block_device:blk_file rw_file_perms;
21allow fsck cache_block_device:blk_file rw_file_perms;
Jeff Sharkey84e1c612015-04-01 10:15:51 -070022allow fsck dm_device:blk_file rw_file_perms;
Stephen Smalley8a0c25e2014-09-23 09:11:30 -040023
Nick Kraleviche4910202015-03-19 23:02:15 -070024###
25### neverallow rules
26###
27
28# fsck should never be run on these block devices
29neverallow fsck {
30 boot_block_device
31 frp_block_device
32 metadata_block_device
33 recovery_block_device
34 root_block_device
35 swap_block_device
36 system_block_device
Jeff Sharkey5a5b3642015-03-31 08:04:46 -070037 vold_device
Nick Kraleviche4910202015-03-19 23:02:15 -070038}:blk_file no_rw_file_perms;
39
Jeff Sharkey84e1c612015-04-01 10:15:51 -070040# Only allow entry from init or vold via fsck binaries
41neverallow { domain -init -vold } fsck:process transition;
Stephen Smalley8a0c25e2014-09-23 09:11:30 -040042neverallow domain fsck:process dyntransition;
Jeff Sharkeyf063f462015-03-27 11:25:39 -070043neverallow fsck { file_type fs_type -fsck_exec }:file entrypoint;