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