1###########################################
2# Root
3/                   u:object_r:rootfs:s0
4
5# Data files
6/adb_keys           u:object_r:adb_keys_file:s0
7/build\.prop        u:object_r:rootfs:s0
8/default\.prop      u:object_r:rootfs:s0
9/fstab\..*          u:object_r:rootfs:s0
10/init\..*           u:object_r:rootfs:s0
11/res(/.*)?          u:object_r:rootfs:s0
12/selinux_version    u:object_r:rootfs:s0
13/ueventd\..*        u:object_r:rootfs:s0
14/verity_key         u:object_r:rootfs:s0
15
16# Executables
17/charger            u:object_r:rootfs:s0
18/init               u:object_r:init_exec:s0
19/sbin(/.*)?         u:object_r:rootfs:s0
20
21# Empty directories
22/lost\+found        u:object_r:rootfs:s0
23/acct               u:object_r:cgroup:s0
24/config             u:object_r:rootfs:s0
25/mnt                u:object_r:tmpfs:s0
26/postinstall        u:object_r:postinstall_mnt_dir:s0
27/proc               u:object_r:rootfs:s0
28/root               u:object_r:rootfs:s0
29/sys                u:object_r:sysfs:s0
30
31# Symlinks
32/d                  u:object_r:rootfs:s0
33/etc                u:object_r:rootfs:s0
34/sdcard             u:object_r:rootfs:s0
35
36# SELinux policy files
37/file_contexts\.bin u:object_r:rootfs:s0
38/property_contexts  u:object_r:property_contexts:s0
39/seapp_contexts     u:object_r:rootfs:s0
40/sepolicy           u:object_r:rootfs:s0
41/service_contexts   u:object_r:rootfs:s0
42
43##########################
44# Devices
45#
46/dev(/.*)?		u:object_r:device:s0
47/dev/akm8973.*		u:object_r:sensors_device:s0
48/dev/accelerometer	u:object_r:sensors_device:s0
49/dev/adf[0-9]*		u:object_r:graphics_device:s0
50/dev/adf-interface[0-9]*\.[0-9]*	u:object_r:graphics_device:s0
51/dev/adf-overlay-engine[0-9]*\.[0-9]*	u:object_r:graphics_device:s0
52/dev/alarm		u:object_r:alarm_device:s0
53/dev/android_adb.*	u:object_r:adb_device:s0
54/dev/ashmem		u:object_r:ashmem_device:s0
55/dev/audio.*		u:object_r:audio_device:s0
56/dev/binder		u:object_r:binder_device:s0
57/dev/block(/.*)?	u:object_r:block_device:s0
58/dev/block/dm-[0-9]+	u:object_r:dm_device:s0
59/dev/block/loop[0-9]*	u:object_r:loop_device:s0
60/dev/block/vold/.+	u:object_r:vold_device:s0
61/dev/block/ram[0-9]*	u:object_r:ram_device:s0
62/dev/block/zram[0-9]*	u:object_r:ram_device:s0
63/dev/bus/usb(.*)?       u:object_r:usb_device:s0
64/dev/cam		u:object_r:video_device:s0
65/dev/console		u:object_r:console_device:s0
66/dev/cpuctl(/.*)?	u:object_r:cpuctl_device:s0
67/dev/device-mapper	u:object_r:dm_device:s0
68/dev/eac		u:object_r:audio_device:s0
69/dev/fscklogs(/.*)?	u:object_r:fscklogs:s0
70/dev/full		u:object_r:full_device:s0
71/dev/fuse		u:object_r:fuse_device:s0
72/dev/graphics(/.*)?	u:object_r:graphics_device:s0
73/dev/hw_random		u:object_r:hw_random_device:s0
74/dev/i2c-[0-9]+		u:object_r:i2c_device:s0
75/dev/input(/.*)		u:object_r:input_device:s0
76/dev/iio:device[0-9]+   u:object_r:iio_device:s0
77/dev/ion		u:object_r:ion_device:s0
78/dev/kmem		u:object_r:kmem_device:s0
79/dev/log(/.*)?		u:object_r:log_device:s0
80/dev/mem		u:object_r:kmem_device:s0
81/dev/modem.*		u:object_r:radio_device:s0
82/dev/mpu		u:object_r:gps_device:s0
83/dev/mpuirq		u:object_r:gps_device:s0
84/dev/mtd(/.*)?		u:object_r:mtd_device:s0
85/dev/mtp_usb		u:object_r:mtp_device:s0
86/dev/pmsg0		u:object_r:pmsg_device:s0
87/dev/pn544		u:object_r:nfc_device:s0
88/dev/ppp		u:object_r:ppp_device:s0
89/dev/ptmx		u:object_r:ptmx_device:s0
90/dev/pvrsrvkm		u:object_r:gpu_device:s0
91/dev/kmsg		u:object_r:kmsg_device:s0
92/dev/null		u:object_r:null_device:s0
93/dev/nvhdcp1		u:object_r:video_device:s0
94/dev/random		u:object_r:random_device:s0
95/dev/rpmsg-omx[0-9]	u:object_r:rpmsg_device:s0
96/dev/rproc_user	u:object_r:rpmsg_device:s0
97/dev/rtc[0-9]      u:object_r:rtc_device:s0
98/dev/snd(/.*)?		u:object_r:audio_device:s0
99/dev/socket(/.*)?	u:object_r:socket_device:s0
100/dev/socket/adbd	u:object_r:adbd_socket:s0
101/dev/socket/sap_uim_socket[0-9]        u:object_r:sap_uim_socket:s0
102/dev/socket/cryptd	u:object_r:vold_socket:s0
103/dev/socket/dnsproxyd	u:object_r:dnsproxyd_socket:s0
104/dev/socket/dumpstate	u:object_r:dumpstate_socket:s0
105/dev/socket/fwmarkd	u:object_r:fwmarkd_socket:s0
106/dev/socket/gps		u:object_r:gps_socket:s0
107/dev/socket/installd	u:object_r:installd_socket:s0
108/dev/socket/lmkd        u:object_r:lmkd_socket:s0
109/dev/socket/logd	u:object_r:logd_socket:s0
110/dev/socket/logdr	u:object_r:logdr_socket:s0
111/dev/socket/logdw	u:object_r:logdw_socket:s0
112/dev/socket/mdns	u:object_r:mdns_socket:s0
113/dev/socket/mdnsd	u:object_r:mdnsd_socket:s0
114/dev/socket/mtpd	u:object_r:mtpd_socket:s0
115/dev/socket/netd	u:object_r:netd_socket:s0
116/dev/socket/property_service	u:object_r:property_socket:s0
117/dev/socket/racoon	u:object_r:racoon_socket:s0
118/dev/socket/rild	u:object_r:rild_socket:s0
119/dev/socket/rild-debug	u:object_r:rild_debug_socket:s0
120/dev/socket/uncrypt	u:object_r:uncrypt_socket:s0
121/dev/socket/vold	u:object_r:vold_socket:s0
122/dev/socket/wpa_eth[0-9] u:object_r:wpa_socket:s0
123/dev/socket/wpa_wlan[0-9] u:object_r:wpa_socket:s0
124/dev/socket/zygote	u:object_r:zygote_socket:s0
125/dev/socket/zygote_secondary	u:object_r:zygote_socket:s0
126/dev/spdif_out.*	u:object_r:audio_device:s0
127/dev/tegra.*		u:object_r:video_device:s0
128/dev/tf_driver		u:object_r:tee_device:s0
129/dev/tty		u:object_r:owntty_device:s0
130/dev/tty[0-9]*		u:object_r:tty_device:s0
131/dev/ttyS[0-9]*		u:object_r:serial_device:s0
132/dev/tun		u:object_r:tun_device:s0
133/dev/uhid		u:object_r:uhid_device:s0
134/dev/uinput		u:object_r:uhid_device:s0
135/dev/uio[0-9]*		u:object_r:uio_device:s0
136/dev/urandom		u:object_r:urandom_device:s0
137/dev/usb_accessory	u:object_r:usbaccessory_device:s0
138/dev/vcs[0-9a-z]*	u:object_r:vcs_device:s0
139/dev/video[0-9]*	u:object_r:video_device:s0
140/dev/watchdog		u:object_r:watchdog_device:s0
141/dev/xt_qtaguid	u:object_r:qtaguid_device:s0
142/dev/zero		u:object_r:zero_device:s0
143/dev/__kmsg__		u:object_r:klog_device:s0
144/dev/__properties__ u:object_r:properties_device:s0
145#############################
146# System files
147#
148/system(/.*)?		u:object_r:system_file:s0
149/system/bin/atrace	u:object_r:atrace_exec:s0
150/system/bin/e2fsck	--	u:object_r:fsck_exec:s0
151/system/bin/fsck\.f2fs	--	u:object_r:fsck_exec:s0
152/system/bin/fsck_msdos	--	u:object_r:fsck_exec:s0
153/system/bin/toolbox	--	u:object_r:toolbox_exec:s0
154/system/bin/toybox	--	u:object_r:toolbox_exec:s0
155/system/bin/logcat	--	u:object_r:logcat_exec:s0
156/system/bin/sh		--	u:object_r:shell_exec:s0
157/system/bin/run-as	--	u:object_r:runas_exec:s0
158/system/bin/bootanimation u:object_r:bootanim_exec:s0
159/system/bin/bootstat		u:object_r:bootstat_exec:s0
160/system/bin/app_process32	u:object_r:zygote_exec:s0
161/system/bin/app_process64	u:object_r:zygote_exec:s0
162/system/bin/servicemanager	u:object_r:servicemanager_exec:s0
163/system/bin/surfaceflinger	u:object_r:surfaceflinger_exec:s0
164/system/bin/drmserver	u:object_r:drmserver_exec:s0
165/system/bin/dumpstate   u:object_r:dumpstate_exec:s0
166/system/bin/vold	u:object_r:vold_exec:s0
167/system/bin/netd	u:object_r:netd_exec:s0
168/system/bin/rild	u:object_r:rild_exec:s0
169/system/bin/audioserver	u:object_r:audioserver_exec:s0
170/system/bin/mediadrmserver	u:object_r:mediadrmserver_exec:s0
171/system/bin/mediaserver	u:object_r:mediaserver_exec:s0
172/system/bin/cameraserver	u:object_r:cameraserver_exec:s0
173/system/bin/mediaextractor	u:object_r:mediaextractor_exec:s0
174/system/bin/mediacodec	u:object_r:mediacodec_exec:s0
175/system/bin/mdnsd	u:object_r:mdnsd_exec:s0
176/system/bin/installd	u:object_r:installd_exec:s0
177/system/bin/otapreopt_chroot   u:object_r:otapreopt_chroot_exec:s0
178/system/bin/keystore	u:object_r:keystore_exec:s0
179/system/bin/fingerprintd u:object_r:fingerprintd_exec:s0
180/system/bin/gatekeeperd u:object_r:gatekeeperd_exec:s0
181/system/bin/debuggerd	u:object_r:debuggerd_exec:s0
182/system/bin/debuggerd64	u:object_r:debuggerd_exec:s0
183/system/bin/wpa_supplicant	u:object_r:wpa_exec:s0
184/system/bin/recovery-persist     u:object_r:recovery_persist_exec:s0
185/system/bin/recovery-refresh     u:object_r:recovery_refresh_exec:s0
186/system/bin/sdcard      u:object_r:sdcardd_exec:s0
187/system/bin/dhcpcd      u:object_r:dhcp_exec:s0
188/system/bin/dhcpcd-6.8.2	u:object_r:dhcp_exec:s0
189/system/bin/mtpd	u:object_r:mtp_exec:s0
190/system/bin/pppd	u:object_r:ppp_exec:s0
191/system/bin/tf_daemon	u:object_r:tee_exec:s0
192/system/bin/racoon	u:object_r:racoon_exec:s0
193/system/xbin/su		u:object_r:su_exec:s0
194/system/xbin/perfprofd  u:object_r:perfprofd_exec:s0
195/system/vendor/bin/gpsd u:object_r:gpsd_exec:s0
196/system/bin/dnsmasq     u:object_r:dnsmasq_exec:s0
197/system/bin/hostapd     u:object_r:hostapd_exec:s0
198/system/bin/clatd	u:object_r:clatd_exec:s0
199/system/bin/lmkd        u:object_r:lmkd_exec:s0
200/system/bin/inputflinger u:object_r:inputflinger_exec:s0
201/system/bin/logd        u:object_r:logd_exec:s0
202/system/bin/uncrypt     u:object_r:uncrypt_exec:s0
203/system/bin/update_verifier u:object_r:update_verifier_exec:s0
204/system/bin/logwrapper  u:object_r:system_file:s0
205/system/bin/vdc         u:object_r:vdc_exec:s0
206/system/bin/install-recovery.sh u:object_r:install_recovery_exec:s0
207/system/bin/dex2oat     u:object_r:dex2oat_exec:s0
208# patchoat executable has (essentially) the same requirements as dex2oat.
209/system/bin/patchoat    u:object_r:dex2oat_exec:s0
210/system/bin/profman     u:object_r:profman_exec:s0
211/system/bin/sgdisk      u:object_r:sgdisk_exec:s0
212/system/bin/blkid       u:object_r:blkid_exec:s0
213/system/bin/tzdatacheck u:object_r:tzdatacheck_exec:s0
214/system/bin/idmap u:object_r:idmap_exec:s0
215/system/bin/update_engine        u:object_r:update_engine_exec:s0
216/system/bin/bspatch              u:object_r:update_engine_exec:s0
217
218#############################
219# Vendor files
220#
221/vendor(/.*)?		u:object_r:system_file:s0
222/vendor/bin/gpsd	u:object_r:gpsd_exec:s0
223
224#############################
225# OEM and ODM files
226#
227/odm(/.*)?              u:object_r:system_file:s0
228/oem(/.*)?              u:object_r:oemfs:s0
229
230
231#############################
232# Data files
233#
234# NOTE: When modifying existing label rules, changes may also need to
235# propagate to the "Expanded data files" section.
236#
237/data(/.*)?		u:object_r:system_data_file:s0
238/data/.layout_version		u:object_r:install_data_file:s0
239/data/unencrypted(/.*)?         u:object_r:unencrypted_data_file:s0
240/data/backup(/.*)?		u:object_r:backup_data_file:s0
241/data/secure/backup(/.*)?	u:object_r:backup_data_file:s0
242/data/security(/.*)?	u:object_r:security_file:s0
243/data/system/ndebugsocket	u:object_r:system_ndebug_socket:s0
244/data/drm(/.*)?		u:object_r:drm_data_file:s0
245/data/gps(/.*)?		u:object_r:gps_data_file:s0
246/data/resource-cache(/.*)? u:object_r:resourcecache_data_file:s0
247/data/dalvik-cache(/.*)? u:object_r:dalvikcache_data_file:s0
248/data/ota(/.*)? u:object_r:ota_data_file:s0
249/data/adb(/.*)?		u:object_r:adb_data_file:s0
250/data/anr(/.*)?		u:object_r:anr_data_file:s0
251/data/app(/.*)?                       u:object_r:apk_data_file:s0
252/data/app/[^/]+/oat(/.*)?                u:object_r:dalvikcache_data_file:s0
253/data/app/vmdl[^/]+\.tmp(/.*)?           u:object_r:apk_tmp_file:s0
254/data/app/vmdl[^/]+\.tmp/oat(/.*)?           u:object_r:dalvikcache_data_file:s0
255/data/app-private(/.*)?               u:object_r:apk_private_data_file:s0
256/data/app-private/vmdl.*\.tmp(/.*)?   u:object_r:apk_private_tmp_file:s0
257/data/tombstones(/.*)?	u:object_r:tombstone_data_file:s0
258/data/local/tmp(/.*)?	u:object_r:shell_data_file:s0
259/data/media(/.*)?	u:object_r:media_rw_data_file:s0
260/data/mediadrm(/.*)?	u:object_r:media_data_file:s0
261/data/nativetest(/.*)?	u:object_r:nativetest_data_file:s0
262/data/property(/.*)?	u:object_r:property_data_file:s0
263/data/preloads(/.*)?	u:object_r:preloads_data_file:s0
264
265# Misc data
266/data/misc/adb(/.*)?            u:object_r:adb_keys_file:s0
267/data/misc/audio(/.*)?          u:object_r:audio_data_file:s0
268/data/misc/audioserver(/.*)?    u:object_r:audioserver_data_file:s0
269/data/misc/bootstat(/.*)?       u:object_r:bootstat_data_file:s0
270/data/misc/boottrace(/.*)?      u:object_r:boottrace_data_file:s0
271/data/misc/bluetooth(/.*)?      u:object_r:bluetooth_data_file:s0
272/data/misc/bluedroid(/.*)?      u:object_r:bluetooth_data_file:s0
273/data/misc/bluedroid/\.a2dp_ctrl u:object_r:bluetooth_socket:s0
274/data/misc/bluedroid/\.a2dp_data u:object_r:bluetooth_socket:s0
275/data/misc/camera(/.*)?         u:object_r:camera_data_file:s0
276/data/misc/dhcp(/.*)?           u:object_r:dhcp_data_file:s0
277/data/misc/dhcp-6.8.2(/.*)?     u:object_r:dhcp_data_file:s0
278/data/misc/gatekeeper(/.*)?     u:object_r:gatekeeper_data_file:s0
279/data/misc/keychain(/.*)?       u:object_r:keychain_data_file:s0
280/data/misc/keystore(/.*)?       u:object_r:keystore_data_file:s0
281/data/misc/logd(/.*)?           u:object_r:misc_logd_file:s0
282/data/misc/media(/.*)?          u:object_r:media_data_file:s0
283/data/misc/net(/.*)?            u:object_r:net_data_file:s0
284/data/misc/recovery(/.*)?       u:object_r:recovery_data_file:s0
285/data/misc/shared_relro(/.*)?   u:object_r:shared_relro_file:s0
286/data/misc/sms(/.*)?            u:object_r:radio_data_file:s0
287/data/misc/systemkeys(/.*)?     u:object_r:systemkeys_data_file:s0
288/data/misc/user(/.*)?           u:object_r:misc_user_data_file:s0
289/data/misc/vpn(/.*)?            u:object_r:vpn_data_file:s0
290/data/misc/wifi(/.*)?           u:object_r:wifi_data_file:s0
291/data/misc/wifi/sockets(/.*)?   u:object_r:wpa_socket:s0
292/data/misc/wifi/sockets/wpa_ctrl.*   u:object_r:system_wpa_socket:s0
293/data/misc/wifi/hostapd(/.*)?   u:object_r:wpa_socket:s0
294/data/misc/zoneinfo(/.*)?       u:object_r:zoneinfo_data_file:s0
295/data/misc/vold(/.*)?           u:object_r:vold_data_file:s0
296/data/misc/perfprofd(/.*)?      u:object_r:perfprofd_data_file:s0
297/data/misc/update_engine(/.*)?  u:object_r:update_engine_data_file:s0
298/data/system/heapdump(/.*)?     u:object_r:heapdump_data_file:s0
299/data/misc/trace(/.*)?          u:object_r:method_trace_data_file:s0
300# TODO(calin) label profile reference differently so that only
301# profman run as a special user can write to them
302/data/misc/profiles/cur(/.*)?       u:object_r:user_profile_data_file:s0
303/data/misc/profiles/cur/[0-9]+/foreign-dex(/.*)? u:object_r:user_profile_foreign_dex_data_file:s0
304/data/misc/profiles/ref(/.*)?       u:object_r:user_profile_data_file:s0
305/data/misc/profman(/.*)?        u:object_r:profman_dump_data_file:s0
306
307# Fingerprint data
308/data/system/users/[0-9]+/fpdata(/.*)? u:object_r:fingerprintd_data_file:s0
309
310# Bootchart data
311/data/bootchart(/.*)?		u:object_r:bootchart_data_file:s0
312
313#############################
314# Expanded data files
315#
316/mnt/expand(/.*)?                                   u:object_r:mnt_expand_file:s0
317/mnt/expand/[^/]+(/.*)?                             u:object_r:system_data_file:s0
318/mnt/expand/[^/]+/app(/.*)?                         u:object_r:apk_data_file:s0
319/mnt/expand/[^/]+/app/[^/]+/oat(/.*)?               u:object_r:dalvikcache_data_file:s0
320/mnt/expand/[^/]+/app/vmdl[^/]+\.tmp(/.*)?          u:object_r:apk_tmp_file:s0
321/mnt/expand/[^/]+/app/vmdl[^/]+\.tmp/oat(/.*)?      u:object_r:dalvikcache_data_file:s0
322/mnt/expand/[^/]+/local/tmp(/.*)?                   u:object_r:shell_data_file:s0
323/mnt/expand/[^/]+/media(/.*)?                       u:object_r:media_rw_data_file:s0
324/mnt/expand/[^/]+/misc/vold(/.*)?                   u:object_r:vold_data_file:s0
325
326# coredump directory for userdebug/eng devices
327/cores(/.*)?                    u:object_r:coredump_file:s0
328
329# Wallpaper files
330/data/system/users/[0-9]+/wallpaper_lock_orig	u:object_r:wallpaper_file:s0
331/data/system/users/[0-9]+/wallpaper_lock	u:object_r:wallpaper_file:s0
332/data/system/users/[0-9]+/wallpaper_orig	u:object_r:wallpaper_file:s0
333/data/system/users/[0-9]+/wallpaper		u:object_r:wallpaper_file:s0
334
335# Ringtone files
336/data/system_de/[0-9]+/ringtones(/.*)?          u:object_r:ringtone_file:s0
337
338# ShortcutManager icons, e.g.
339#   /data/system_ce/0/shortcut_service/bitmaps/com.example.app/1457472879282.png
340/data/system_ce/[0-9]+/shortcut_service/bitmaps(/.*)? u:object_r:shortcut_manager_icons:s0
341
342# User icon files
343/data/system/users/[0-9]+/photo.png             u:object_r:icon_file:s0
344
345#############################
346# efs files
347#
348/efs(/.*)?		u:object_r:efs_file:s0
349
350#############################
351# Cache files
352#
353/cache(/.*)?		u:object_r:cache_file:s0
354/cache/recovery(/.*)?	u:object_r:cache_recovery_file:s0
355# General backup/restore interchange with apps
356/cache/backup_stage(/.*)?	u:object_r:cache_backup_file:s0
357# LocalTransport (backup) uses this subtree
358/cache/backup(/.*)?		u:object_r:cache_private_backup_file:s0
359
360/data/cache(/.*)?		u:object_r:cache_file:s0
361/data/cache/recovery(/.*)?	u:object_r:cache_recovery_file:s0
362# General backup/restore interchange with apps
363/data/cache/backup_stage(/.*)?	u:object_r:cache_backup_file:s0
364# LocalTransport (backup) uses this subtree
365/data/cache/backup(/.*)?	u:object_r:cache_private_backup_file:s0
366
367#############################
368# sysfs files
369#
370/sys/devices/platform/nfc-power/nfc_power -- u:object_r:sysfs_nfc_power_writable:s0
371/sys/devices/system/cpu(/.*)?    u:object_r:sysfs_devices_system_cpu:s0
372/sys/devices/virtual/block/zram\d+(/.*)?     u:object_r:sysfs_zram:s0
373/sys/devices/virtual/block/zram\d+/uevent    u:object_r:sysfs_zram_uevent:s0
374/sys/devices/virtual/misc/hw_random(/.*)?    u:object_r:sysfs_hwrandom:s0
375/sys/power/wake_lock -- u:object_r:sysfs_wake_lock:s0
376/sys/power/wake_unlock -- u:object_r:sysfs_wake_lock:s0
377/sys/kernel/uevent_helper --	u:object_r:usermodehelper:s0
378/sys/module/lowmemorykiller(/.*)? -- u:object_r:sysfs_lowmemorykiller:s0
379
380#############################
381# debugfs files
382#
383/sys/kernel/debug/tracing(/.*)?          u:object_r:debugfs_tracing:s0
384/sys/kernel/debug/tracing/trace_marker   u:object_r:debugfs_trace_marker:s0
385
386#############################
387# asec containers
388/mnt/asec(/.*)?             u:object_r:asec_apk_file:s0
389/mnt/asec/[^/]+/[^/]+\.zip  u:object_r:asec_public_file:s0
390/mnt/asec/[^/]+/lib(/.*)?   u:object_r:asec_public_file:s0
391/data/app-asec(/.*)?        u:object_r:asec_image_file:s0
392
393#############################
394# external storage
395/mnt/media_rw(/.*)?         u:object_r:mnt_media_rw_file:s0
396/mnt/user(/.*)?             u:object_r:mnt_user_file:s0
397/mnt/runtime(/.*)?          u:object_r:storage_file:s0
398/storage(/.*)?              u:object_r:storage_file:s0
399