blob: 1457c79acb006bd2b26c7860865a9d4ebe22021c [file] [log] [blame]
Stephen Smalley2dd4e512012-01-04 12:33:27 -05001#
2# Apps that run with the system UID, e.g. com.android.system.ui,
3# com.android.settings. These are not as privileged as the system
4# server.
5#
6type system_app, domain;
7app_domain(system_app)
8
9# Perform binder IPC to any app domain.
10binder_call(system_app, appdomain)
11binder_transfer(system_app, appdomain)
12
13# Read and write system data files.
14# May want to split into separate types.
15allow system_app system_data_file:dir create_dir_perms;
16allow system_app system_data_file:file create_file_perms;
17
Stephen Smalleyf6cbbe22012-03-19 10:29:36 -040018# Read wallpaper file.
19allow system_app wallpaper_file:file r_file_perms;
20
Stephen Smalley2dd4e512012-01-04 12:33:27 -050021# Write to dalvikcache.
22allow system_app dalvikcache_data_file:file { write setattr };
23
24# Talk to keystore.
25unix_socket_connect(system_app, keystore, keystore)
26
27# Read SELinux enforcing status.
28selinux_getenforce(system_app)
29
Stephen Smalley965f2ff2012-06-14 12:33:38 -040030bool manage_selinux true;
31if (manage_selinux) {
32# Set SELinux enforcing status.
Stephen Smalley4c6f1ce2012-02-02 13:28:44 -050033selinux_setenforce(system_app)
34
Stephen Smalley965f2ff2012-06-14 12:33:38 -040035# Set SELinux booleans.
Stephen Smalley4c6f1ce2012-02-02 13:28:44 -050036selinux_setbool(system_app)
James Cartera83fc372012-04-13 13:35:21 -040037
Stephen Smalley965f2ff2012-06-14 12:33:38 -040038# Read syslog to display AVC messages.
James Cartera83fc372012-04-13 13:35:21 -040039allow system_app kernel:system syslog_read;
Stephen Smalley965f2ff2012-06-14 12:33:38 -040040}
James Cartera83fc372012-04-13 13:35:21 -040041
Stephen Smalley965f2ff2012-06-14 12:33:38 -040042bool manage_mac true;
43if (manage_mac) {
44# Set properties via the init property service.
45unix_socket_connect(system_app, property, init)
46
47# Set the persist.mac_enforcing_mode property.
48allow system_app system_prop:property_service set;
49
50# Run logcat and read the logs for MAC denials.
51allow system_app system_file:file x_file_perms;
52allow system_app log_device:chr_file read;
Stephen Smalley4c6f1ce2012-02-02 13:28:44 -050053}
54
Stephen Smalley2dd4e512012-01-04 12:33:27 -050055#
56# System Server aka system_server spawned by zygote.
57# Most of the framework services run in this process.
58#
59type system, domain, mlstrustedsubject;
60
61# Child of the zygote.
62allow system zygote:fd use;
63allow system zygote:process sigchld;
64allow system zygote_tmpfs:file read;
65
66# system server gets network and bluetooth permissions.
67net_domain(system)
68bluetooth_domain(system)
69
70# These are the capabilities assigned by the zygote to the
71# system server.
72# XXX See if we can remove some of these.
73allow system self:capability { kill net_bind_service net_broadcast net_admin net_raw sys_module sys_boot sys_nice sys_resource sys_time sys_tty_config };
74
75# Use netlink uevent sockets.
76allow system self:netlink_kobject_uevent_socket *;
77
78# Kill apps.
79allow system appdomain:process { sigkill signal };
80
Stephen Smalley0d76f4e2012-01-10 13:21:28 -050081# Set scheduling info for apps.
82allow system appdomain:process setsched;
83
Stephen Smalley2dd4e512012-01-04 12:33:27 -050084# Read /proc data for apps.
85allow system appdomain:dir r_dir_perms;
86allow system appdomain:{ file lnk_file } rw_file_perms;
87
88# Write to /proc/net/xt_qtaguid/ctrl.
Stephen Smalley35c8d4f2012-06-27 09:15:38 -040089allow system qtaguid:file rw_file_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -050090
91# Notify init of death.
92allow system init:process sigchld;
93
94# Talk to init and various daemons via sockets.
95unix_socket_connect(system, property, init)
96unix_socket_connect(system, qemud, qemud)
97unix_socket_connect(system, installd, installd)
98unix_socket_connect(system, netd, netd)
99unix_socket_connect(system, vold, vold)
100unix_socket_connect(system, zygote, zygote)
101unix_socket_connect(system, keystore, keystore)
102unix_socket_connect(system, dbus, dbusd)
103unix_socket_connect(system, gps, gpsd)
104unix_socket_connect(system, bluetooth, bluetoothd)
105unix_socket_send(system, wpa, wpa)
106
107# Perform Binder IPC.
108tmpfs_domain(system)
109binder_use(system)
110binder_call(system, binderservicedomain)
111binder_call(system, appdomain)
112binder_service(system)
113# Transfer other Binder references.
114binder_transfer(system, binderservicedomain)
115binder_transfer(system, appdomain)
116
117# Read /proc/pid files for Binder clients.
118r_dir_file(system, appdomain)
119r_dir_file(system, mediaserver)
120allow system appdomain:process getattr;
121allow system mediaserver:process getattr;
122
123# Specify any arguments to zygote.
124allow system self:zygote *;
125
126# Check SELinux permissions.
127selinux_check_access(system)
128
129# XXX Label sysfs files with a specific type?
130allow system sysfs:file rw_file_perms;
Stephen Smalleyf7948232012-03-19 15:56:01 -0400131allow system sysfs_nfc_power_writable:file rw_file_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500132
133# Access devices.
Stephen Smalleyc94e2392012-01-06 10:25:53 -0500134allow system device:dir r_dir_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500135allow system device:chr_file rw_file_perms;
136allow system akm_device:chr_file rw_file_perms;
137allow system accelerometer_device:chr_file rw_file_perms;
138allow system alarm_device:chr_file rw_file_perms;
139allow system graphics_device:dir search;
140allow system graphics_device:chr_file rw_file_perms;
141allow system input_device:dir r_dir_perms;
142allow system input_device:chr_file rw_file_perms;
143allow system tty_device:chr_file rw_file_perms;
144allow system urandom_device:chr_file rw_file_perms;
145allow system video_device:chr_file rw_file_perms;
146allow system qemu_device:chr_file rw_file_perms;
147
148# Manage data files.
149allow system data_file_type:dir create_dir_perms;
150allow system data_file_type:notdevfile_class_set create_file_perms;
151
Stephen Smalley59d28032012-03-19 10:24:52 -0400152# Read /file_contexts.
153allow system rootfs:file r_file_perms;
154
155# Relabel apk files.
156allow system apk_tmp_file:file { relabelfrom relabelto };
157allow system apk_data_file:file { relabelfrom relabelto };
158
Stephen Smalleyf6cbbe22012-03-19 10:29:36 -0400159# Relabel wallpaper.
160allow system system_data_file:file relabelfrom;
161allow system wallpaper_file:file relabelto;
Stephen Smalley6c39ee02012-06-27 08:50:27 -0400162allow system wallpaper_file:file rw_file_perms;
Stephen Smalleyf6cbbe22012-03-19 10:29:36 -0400163
Stephen Smalley124720a2012-04-04 10:11:16 -0400164# Property Service write
165allow system system_prop:property_service set;
Stephen Smalley730957a2012-04-04 16:01:19 -0400166allow system radio_prop:property_service set;
Stephen Smalley124720a2012-04-04 10:11:16 -0400167
168# ctl interface
169allow system ctl_default_prop:property_service set;
170
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500171# Create a socket for receiving info from wpa.
172type_transition system wifi_data_file:sock_file system_wpa_socket;
173allow system system_wpa_socket:sock_file create_file_perms;
174
175# Manage cache files.
176allow system cache_file:dir create_dir_perms;
177allow system cache_file:file create_file_perms;
178
179# Run system programs, e.g. dexopt.
180allow system system_file:file x_file_perms;
181
Stephen Smalleyc83d0082012-03-07 14:59:01 -0500182# Allow reading of /proc/pid data for other domains.
183# XXX dontaudit candidate
184allow system domain:dir r_dir_perms;
185allow system domain:file r_file_perms;