1 # volume manager 2 type vold, domain; 3 type vold_exec, exec_type, file_type; 4 5 # Read already opened /cache files. 6 allow vold cache_file:dir r_dir_perms; 7 allow vold cache_file:file { getattr read }; 8 allow vold cache_file:lnk_file r_file_perms; 9 10 # Read access to pseudo filesystems. 11 r_dir_file(vold, proc) 12 r_dir_file(vold, proc_net) 13 r_dir_file(vold, sysfs_type) 14 # XXX Label sysfs files with a specific type? 15 allow vold sysfs:file w_file_perms; 16 allow vold sysfs_usb:file w_file_perms; 17 allow vold sysfs_zram_uevent:file w_file_perms; 18 19 r_dir_file(vold, rootfs) 20 allow vold proc_meminfo:file r_file_perms; 21 22 #Get file contexts 23 allow vold file_contexts_file:file r_file_perms; 24 25 # Allow us to jump into execution domains of above tools 26 allow vold self:process setexec; 27 28 # For sgdisk launched through popen() 29 allow vold shell_exec:file rx_file_perms; 30 31 typeattribute vold mlstrustedsubject; 32 allow vold self:process setfscreate; 33 allow vold system_file:file x_file_perms; 34 not_full_treble(`allow vold vendor_file:file x_file_perms;') 35 allow vold block_device:dir create_dir_perms; 36 allow vold device:dir write; 37 allow vold devpts:chr_file rw_file_perms; 38 allow vold rootfs:dir mounton; 39 allow vold sdcard_type:dir mounton; # TODO: deprecated in M 40 allow vold sdcard_type:filesystem { mount remount unmount }; # TODO: deprecated in M 41 allow vold sdcard_type:dir create_dir_perms; # TODO: deprecated in M 42 allow vold sdcard_type:file create_file_perms; # TODO: deprecated in M 43 44 # Manage locations where storage is mounted 45 allow vold { mnt_media_rw_file storage_file sdcard_type }:dir create_dir_perms; 46 allow vold { mnt_media_rw_file storage_file sdcard_type }:file create_file_perms; 47 48 # Access to storage that backs emulated FUSE daemons for migration optimization 49 allow vold media_rw_data_file:dir create_dir_perms; 50 allow vold media_rw_data_file:file create_file_perms; 51 52 # Allow mounting of storage devices 53 allow vold { mnt_media_rw_stub_file storage_stub_file }:dir { mounton create rmdir getattr setattr }; 54 55 # Manage per-user primary symlinks 56 allow vold mnt_user_file:dir create_dir_perms; 57 allow vold mnt_user_file:lnk_file create_file_perms; 58 59 # Allow to create and mount expanded storage 60 allow vold mnt_expand_file:dir { create_dir_perms mounton }; 61 allow vold apk_data_file:dir { create getattr setattr }; 62 allow vold shell_data_file:dir { create getattr setattr }; 63 64 allow vold tmpfs:filesystem { mount unmount }; 65 allow vold tmpfs:dir create_dir_perms; 66 allow vold tmpfs:dir mounton; 67 allow vold self:capability { net_admin dac_override mknod sys_admin chown fowner fsetid }; 68 allow vold self:netlink_kobject_uevent_socket create_socket_perms_no_ioctl; 69 allow vold app_data_file:dir search; 70 allow vold app_data_file:file rw_file_perms; 71 allow vold loop_control_device:chr_file rw_file_perms; 72 allow vold loop_device:blk_file { create setattr unlink rw_file_perms }; 73 allow vold vold_device:blk_file { create setattr unlink rw_file_perms }; 74 allow vold dm_device:chr_file rw_file_perms; 75 allow vold dm_device:blk_file rw_file_perms; 76 # For vold Process::killProcessesWithOpenFiles function. 77 allow vold domain:dir r_dir_perms; 78 allow vold domain:{ file lnk_file } r_file_perms; 79 allow vold domain:process { signal sigkill }; 80 allow vold self:capability { sys_ptrace kill }; 81 82 # XXX Label sysfs files with a specific type? 83 allow vold sysfs:file rw_file_perms; 84 85 allow vold kmsg_device:chr_file rw_file_perms; 86 87 # Run fsck in the fsck domain. 88 allow vold fsck_exec:file { r_file_perms execute }; 89 90 # Log fsck results 91 allow vold fscklogs:dir rw_dir_perms; 92 allow vold fscklogs:file create_file_perms; 93 94 # 95 # Rules to support encrypted fs support. 96 # 97 98 # Unmount and mount the fs. 99 allow vold labeledfs:filesystem { mount unmount }; 100 101 # Access /efs/userdata_footer. 102 # XXX Split into a separate type? 103 allow vold efs_file:file rw_file_perms; 104 105 # Create and mount on /data/tmp_mnt and management of expansion mounts 106 allow vold system_data_file:dir { create rw_dir_perms mounton setattr rmdir }; 107 108 # Set scheduling policy of kernel processes 109 allow vold kernel:process setsched; 110 111 # Property Service 112 set_prop(vold, vold_prop) 113 set_prop(vold, powerctl_prop) 114 set_prop(vold, ctl_fuse_prop) 115 set_prop(vold, restorecon_prop) 116 117 # ASEC 118 allow vold asec_image_file:file create_file_perms; 119 allow vold asec_image_file:dir rw_dir_perms; 120 allow vold asec_apk_file:dir { create_dir_perms mounton relabelfrom relabelto }; 121 allow vold asec_public_file:dir { relabelto setattr }; 122 allow vold asec_apk_file:file { r_file_perms setattr relabelfrom relabelto }; 123 allow vold asec_public_file:file { relabelto setattr }; 124 # restorecon files in asec containers created on 4.2 or earlier. 125 allow vold unlabeled:dir { r_dir_perms setattr relabelfrom }; 126 allow vold unlabeled:file { r_file_perms setattr relabelfrom }; 127 128 # Handle wake locks (used for device encryption) 129 wakelock_use(vold) 130 131 # talk to batteryservice 132 binder_use(vold) 133 binder_call(vold, healthd) 134 135 # talk to keymaster 136 hal_client_domain(vold, hal_keymaster) 137 138 # Access userdata block device. 139 allow vold userdata_block_device:blk_file rw_file_perms; 140 141 # Access metadata block device used for encryption meta-data. 142 allow vold metadata_block_device:blk_file rw_file_perms; 143 144 # Allow vold to manipulate /data/unencrypted 145 allow vold unencrypted_data_file:{ file } create_file_perms; 146 allow vold unencrypted_data_file:dir create_dir_perms; 147 148 # Write to /proc/sys/vm/drop_caches 149 allow vold proc_drop_caches:file w_file_perms; 150 151 # Give vold a place where only vold can store files; everyone else is off limits 152 allow vold vold_data_file:dir create_dir_perms; 153 allow vold vold_data_file:file create_file_perms; 154 155 # linux keyring configuration 156 allow vold init:key { write search setattr }; 157 allow vold vold:key { write search setattr }; 158 159 # vold temporarily changes its priority when running benchmarks 160 allow vold self:capability sys_nice; 161 162 # vold needs to chroot into app namespaces to remount when runtime permissions change 163 allow vold self:capability sys_chroot; 164 allow vold storage_file:dir mounton; 165 166 # For AppFuse. 167 allow vold fuse_device:chr_file rw_file_perms; 168 allow vold fuse:filesystem { relabelfrom }; 169 allow vold app_fusefs:filesystem { relabelfrom relabelto }; 170 allow vold app_fusefs:filesystem { mount unmount }; 171 172 # MoveTask.cpp executes cp and rm 173 allow vold toolbox_exec:file rx_file_perms; 174 175 # Prepare profile dir for users. 176 allow vold user_profile_data_file:dir create_dir_perms; 177 178 # Raw writes to misc block device 179 allow vold misc_block_device:blk_file w_file_perms; 180 181 neverallow { domain -vold } vold_data_file:dir ~{ open create read getattr setattr search relabelto ioctl }; 182 neverallow { domain -vold -kernel } vold_data_file:notdevfile_class_set ~{ relabelto getattr }; 183 neverallow { domain -vold -init } vold_data_file:dir *; 184 neverallow { domain -vold -init -kernel } vold_data_file:notdevfile_class_set *; 185 neverallow { domain -vold -init } restorecon_prop:property_service set; 186 187 neverallow vold fsck_exec:file execute_no_trans; 188