blob: add3b9c10a24479a322d6872c4988daf020b5733 [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001# zygote
2type zygote, domain;
3type zygote_exec, exec_type, file_type;
4
5init_daemon_domain(zygote)
Nick Kralevich6aca5152013-07-01 12:07:03 -07006typeattribute zygote mlstrustedsubject;
7# Override DAC on files and switch uid/gid.
Narayan Kamath3a06a722014-04-28 15:17:29 +01008allow zygote self:capability { dac_override setgid setuid fowner chown };
Nick Kralevich6aca5152013-07-01 12:07:03 -07009# Drop capabilities from bounding set.
10allow zygote self:capability setpcap;
11# Switch SELinux context to app domains.
Stephen Smalley356f4be2014-05-23 11:26:19 -040012allow zygote self:process setcurrent;
Alex Klyubin1fdee112013-09-13 15:59:04 -070013allow zygote system_server:process dyntransition;
Nick Kralevich6aca5152013-07-01 12:07:03 -070014allow zygote appdomain:process dyntransition;
Nick Kraleviche9c41812013-09-20 13:09:37 -070015# Allow zygote to read app /proc/pid dirs (b/10455872)
Geremy Condra81560732013-08-30 13:02:30 -070016allow zygote appdomain:dir { getattr search };
Nick Kralevich199fc732013-09-20 13:03:04 -070017allow zygote appdomain:file { r_file_perms };
Nick Kralevich6aca5152013-07-01 12:07:03 -070018# Move children into the peer process group.
Alex Klyubin1fdee112013-09-13 15:59:04 -070019allow zygote system_server:process { getpgid setpgid };
Nick Kralevich6aca5152013-07-01 12:07:03 -070020allow zygote appdomain:process { getpgid setpgid };
Stephen Smalleydf48bd22014-05-14 08:58:06 -040021# Read system data.
22allow zygote system_data_file:dir r_dir_perms;
23allow zygote system_data_file:file r_file_perms;
24# Write to /data/dalvik-cache.
Narayan Kamath3a06a722014-04-28 15:17:29 +010025allow zygote dalvikcache_data_file:dir create_dir_perms;
Stephen Smalley49c995d2014-01-09 09:27:15 -050026allow zygote dalvikcache_data_file:file create_file_perms;
Igor Murashkinf7ccfd02014-10-24 14:22:12 -070027# Create symlinks in /data/dalvik-cache
28allow zygote dalvikcache_data_file:lnk_file create_file_perms;
Nick Kralevichfad4d5f2014-06-16 14:19:31 -070029# Write to /data/resource-cache
30allow zygote resourcecache_data_file:dir rw_dir_perms;
31allow zygote resourcecache_data_file:file create_file_perms;
Stephen Smalley49c995d2014-01-09 09:27:15 -050032# For art.
33allow zygote dalvikcache_data_file:file execute;
Nick Kralevich6aca5152013-07-01 12:07:03 -070034# Execute dexopt.
35allow zygote system_file:file x_file_perms;
Ed Heyl8ee37b42014-07-14 23:32:08 -070036allow zygote dex2oat_exec:file rx_file_perms;
Nick Kralevich6aca5152013-07-01 12:07:03 -070037# Control cgroups.
38allow zygote cgroup:dir create_dir_perms;
39allow zygote self:capability sys_admin;
Peter Leed3349b32016-10-14 15:50:09 +080040# Allow zygote to stat the files that it opens. The zygote must
41# be able to inspect them so that it can reopen them on fork
42# if necessary: b/30963384
43# allow zygote pmsg_device:chr_file { getattr };
44allow zygote debugfs:dir search;
45allow zygote debugfs:file { getattr };
46
Nick Kralevich6aca5152013-07-01 12:07:03 -070047# Check validity of SELinux context before use.
48selinux_check_context(zygote)
49# Check SELinux permissions.
50selinux_check_access(zygote)
51# Read /seapp_contexts and /data/security/seapp_contexts
52security_access_policy(zygote)
53
Nick Kralevichf2c01182014-09-26 10:51:12 -070054# Native bridge functionality requires that zygote replaces
55# /proc/cpuinfo with /system/lib/<ISA>/cpuinfo using a bind mount
56allow zygote proc_cpuinfo:file mounton;
57
Nick Kralevich6aca5152013-07-01 12:07:03 -070058# Setting up /storage/emulated.
59allow zygote rootfs:dir mounton;
60allow zygote sdcard_type:dir { write search setattr create add_name mounton };
61dontaudit zygote self:capability fsetid;
62allow zygote tmpfs:dir { write create add_name setattr mounton search };
63allow zygote tmpfs:filesystem mount;
64allow zygote labeledfs:filesystem remount;
65
66# Handle --invoke-with command when launching Zygote with a wrapper command.
Stephen Smalley3bfdc6b2014-03-10 10:31:09 -040067allow zygote zygote_exec:file rx_file_perms;