blob: 6389b0ee168d719688916c68233ba97fac4495f8 [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 Smalley4c6f1ce2012-02-02 13:28:44 -050030bool settings_manage_selinux true;
31if (settings_manage_selinux) {
32# Allow settings app to set SELinux to enforcing
33selinux_setenforce(system_app)
34
35# Allow settings app to set SELinux booleans
36selinux_setbool(system_app)
James Cartera83fc372012-04-13 13:35:21 -040037
38# Allow settings app to read syslog to display AVC messages
39allow system_app kernel:system syslog_read;
40
Stephen Smalley4c6f1ce2012-02-02 13:28:44 -050041}
42
Stephen Smalley2dd4e512012-01-04 12:33:27 -050043#
44# System Server aka system_server spawned by zygote.
45# Most of the framework services run in this process.
46#
47type system, domain, mlstrustedsubject;
48
49# Child of the zygote.
50allow system zygote:fd use;
51allow system zygote:process sigchld;
52allow system zygote_tmpfs:file read;
53
54# system server gets network and bluetooth permissions.
55net_domain(system)
56bluetooth_domain(system)
57
58# These are the capabilities assigned by the zygote to the
59# system server.
60# XXX See if we can remove some of these.
61allow 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 };
62
63# Use netlink uevent sockets.
64allow system self:netlink_kobject_uevent_socket *;
65
66# Kill apps.
67allow system appdomain:process { sigkill signal };
68
Stephen Smalley0d76f4e2012-01-10 13:21:28 -050069# Set scheduling info for apps.
70allow system appdomain:process setsched;
71
Stephen Smalley2dd4e512012-01-04 12:33:27 -050072# Read /proc data for apps.
73allow system appdomain:dir r_dir_perms;
74allow system appdomain:{ file lnk_file } rw_file_perms;
75
76# Write to /proc/net/xt_qtaguid/ctrl.
77# XXX Split /proc/net into its own type.
78allow system proc:file write;
79
80# Notify init of death.
81allow system init:process sigchld;
82
83# Talk to init and various daemons via sockets.
84unix_socket_connect(system, property, init)
85unix_socket_connect(system, qemud, qemud)
86unix_socket_connect(system, installd, installd)
87unix_socket_connect(system, netd, netd)
88unix_socket_connect(system, vold, vold)
89unix_socket_connect(system, zygote, zygote)
90unix_socket_connect(system, keystore, keystore)
91unix_socket_connect(system, dbus, dbusd)
92unix_socket_connect(system, gps, gpsd)
93unix_socket_connect(system, bluetooth, bluetoothd)
94unix_socket_send(system, wpa, wpa)
95
96# Perform Binder IPC.
97tmpfs_domain(system)
98binder_use(system)
99binder_call(system, binderservicedomain)
100binder_call(system, appdomain)
101binder_service(system)
102# Transfer other Binder references.
103binder_transfer(system, binderservicedomain)
104binder_transfer(system, appdomain)
105
106# Read /proc/pid files for Binder clients.
107r_dir_file(system, appdomain)
108r_dir_file(system, mediaserver)
109allow system appdomain:process getattr;
110allow system mediaserver:process getattr;
111
112# Specify any arguments to zygote.
113allow system self:zygote *;
114
115# Check SELinux permissions.
116selinux_check_access(system)
117
118# XXX Label sysfs files with a specific type?
119allow system sysfs:file rw_file_perms;
Stephen Smalleyf7948232012-03-19 15:56:01 -0400120allow system sysfs_nfc_power_writable:file rw_file_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500121
122# Access devices.
Stephen Smalleyc94e2392012-01-06 10:25:53 -0500123allow system device:dir r_dir_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500124allow system device:chr_file rw_file_perms;
125allow system akm_device:chr_file rw_file_perms;
126allow system accelerometer_device:chr_file rw_file_perms;
127allow system alarm_device:chr_file rw_file_perms;
128allow system graphics_device:dir search;
129allow system graphics_device:chr_file rw_file_perms;
130allow system input_device:dir r_dir_perms;
131allow system input_device:chr_file rw_file_perms;
132allow system tty_device:chr_file rw_file_perms;
133allow system urandom_device:chr_file rw_file_perms;
134allow system video_device:chr_file rw_file_perms;
135allow system qemu_device:chr_file rw_file_perms;
136
137# Manage data files.
138allow system data_file_type:dir create_dir_perms;
139allow system data_file_type:notdevfile_class_set create_file_perms;
140
Stephen Smalley59d28032012-03-19 10:24:52 -0400141# Read /file_contexts.
142allow system rootfs:file r_file_perms;
143
144# Relabel apk files.
145allow system apk_tmp_file:file { relabelfrom relabelto };
146allow system apk_data_file:file { relabelfrom relabelto };
147
Stephen Smalleyf6cbbe22012-03-19 10:29:36 -0400148# Relabel wallpaper.
149allow system system_data_file:file relabelfrom;
150allow system wallpaper_file:file relabelto;
151allow system wallpaper_file:file r_file_perms;
152
Stephen Smalley124720a2012-04-04 10:11:16 -0400153# Property Service write
154allow system system_prop:property_service set;
Stephen Smalley730957a2012-04-04 16:01:19 -0400155allow system radio_prop:property_service set;
Stephen Smalley124720a2012-04-04 10:11:16 -0400156
157# ctl interface
158allow system ctl_default_prop:property_service set;
159
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500160# Create a socket for receiving info from wpa.
161type_transition system wifi_data_file:sock_file system_wpa_socket;
162allow system system_wpa_socket:sock_file create_file_perms;
163
164# Manage cache files.
165allow system cache_file:dir create_dir_perms;
166allow system cache_file:file create_file_perms;
167
168# Run system programs, e.g. dexopt.
169allow system system_file:file x_file_perms;
170
Stephen Smalleyc83d0082012-03-07 14:59:01 -0500171# Allow reading of /proc/pid data for other domains.
172# XXX dontaudit candidate
173allow system domain:dir r_dir_perms;
174allow system domain:file r_file_perms;