blob: 2030af46789484ce4c95769cf6608d0bd88e1ac4 [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
Stephen Smalley60e4f112012-06-28 14:28:24 -040075# Trigger module auto-load.
76allow system kernel:system module_request;
77
Stephen Smalley2dd4e512012-01-04 12:33:27 -050078# Use netlink uevent sockets.
79allow system self:netlink_kobject_uevent_socket *;
80
81# Kill apps.
82allow system appdomain:process { sigkill signal };
83
Stephen Smalley0d76f4e2012-01-10 13:21:28 -050084# Set scheduling info for apps.
85allow system appdomain:process setsched;
86
Stephen Smalley2dd4e512012-01-04 12:33:27 -050087# Read /proc data for apps.
88allow system appdomain:dir r_dir_perms;
89allow system appdomain:{ file lnk_file } rw_file_perms;
90
91# Write to /proc/net/xt_qtaguid/ctrl.
Stephen Smalley35c8d4f2012-06-27 09:15:38 -040092allow system qtaguid:file rw_file_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -050093
94# Notify init of death.
95allow system init:process sigchld;
96
97# Talk to init and various daemons via sockets.
98unix_socket_connect(system, property, init)
99unix_socket_connect(system, qemud, qemud)
100unix_socket_connect(system, installd, installd)
101unix_socket_connect(system, netd, netd)
102unix_socket_connect(system, vold, vold)
103unix_socket_connect(system, zygote, zygote)
104unix_socket_connect(system, keystore, keystore)
105unix_socket_connect(system, dbus, dbusd)
106unix_socket_connect(system, gps, gpsd)
107unix_socket_connect(system, bluetooth, bluetoothd)
108unix_socket_send(system, wpa, wpa)
109
110# Perform Binder IPC.
111tmpfs_domain(system)
112binder_use(system)
113binder_call(system, binderservicedomain)
114binder_call(system, appdomain)
115binder_service(system)
116# Transfer other Binder references.
117binder_transfer(system, binderservicedomain)
118binder_transfer(system, appdomain)
119
120# Read /proc/pid files for Binder clients.
121r_dir_file(system, appdomain)
122r_dir_file(system, mediaserver)
123allow system appdomain:process getattr;
124allow system mediaserver:process getattr;
125
126# Specify any arguments to zygote.
127allow system self:zygote *;
128
129# Check SELinux permissions.
130selinux_check_access(system)
131
132# XXX Label sysfs files with a specific type?
133allow system sysfs:file rw_file_perms;
Stephen Smalleyf7948232012-03-19 15:56:01 -0400134allow system sysfs_nfc_power_writable:file rw_file_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500135
136# Access devices.
Stephen Smalleyc94e2392012-01-06 10:25:53 -0500137allow system device:dir r_dir_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500138allow system device:chr_file rw_file_perms;
Stephen Smalley60e4f112012-06-28 14:28:24 -0400139allow system device:sock_file rw_file_perms;
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500140allow system akm_device:chr_file rw_file_perms;
141allow system accelerometer_device:chr_file rw_file_perms;
142allow system alarm_device:chr_file rw_file_perms;
143allow system graphics_device:dir search;
144allow system graphics_device:chr_file rw_file_perms;
145allow system input_device:dir r_dir_perms;
146allow system input_device:chr_file rw_file_perms;
147allow system tty_device:chr_file rw_file_perms;
148allow system urandom_device:chr_file rw_file_perms;
149allow system video_device:chr_file rw_file_perms;
150allow system qemu_device:chr_file rw_file_perms;
151
152# Manage data files.
153allow system data_file_type:dir create_dir_perms;
154allow system data_file_type:notdevfile_class_set create_file_perms;
155
Stephen Smalley59d28032012-03-19 10:24:52 -0400156# Read /file_contexts.
157allow system rootfs:file r_file_perms;
158
159# Relabel apk files.
160allow system apk_tmp_file:file { relabelfrom relabelto };
161allow system apk_data_file:file { relabelfrom relabelto };
162
Stephen Smalleyf6cbbe22012-03-19 10:29:36 -0400163# Relabel wallpaper.
164allow system system_data_file:file relabelfrom;
165allow system wallpaper_file:file relabelto;
Stephen Smalley6c39ee02012-06-27 08:50:27 -0400166allow system wallpaper_file:file rw_file_perms;
Stephen Smalleyf6cbbe22012-03-19 10:29:36 -0400167
Stephen Smalley124720a2012-04-04 10:11:16 -0400168# Property Service write
169allow system system_prop:property_service set;
Stephen Smalley730957a2012-04-04 16:01:19 -0400170allow system radio_prop:property_service set;
Stephen Smalley124720a2012-04-04 10:11:16 -0400171
172# ctl interface
173allow system ctl_default_prop:property_service set;
174
Stephen Smalley2dd4e512012-01-04 12:33:27 -0500175# Create a socket for receiving info from wpa.
176type_transition system wifi_data_file:sock_file system_wpa_socket;
177allow system system_wpa_socket:sock_file create_file_perms;
178
179# Manage cache files.
180allow system cache_file:dir create_dir_perms;
181allow system cache_file:file create_file_perms;
182
183# Run system programs, e.g. dexopt.
184allow system system_file:file x_file_perms;
185
Stephen Smalleyc83d0082012-03-07 14:59:01 -0500186# Allow reading of /proc/pid data for other domains.
187# XXX dontaudit candidate
188allow system domain:dir r_dir_perms;
189allow system domain:file r_file_perms;