blob: 1b60ea7166e84f79fce28060022094e704395964 [file] [log] [blame]
Alex Klyubin1fdee112013-09-13 15:59:04 -07001#
2# System Server aka system_server spawned by zygote.
3# Most of the framework services run in this process.
4#
Stephen Smalley1ff64412013-10-29 14:42:40 -04005type system_server, domain, mlstrustedsubject;
6permissive system_server;
7
Stephen Smalleye7ec2f52013-12-23 16:18:55 -05008# Define a type for tmpfs-backed ashmem regions.
9tmpfs_domain(system_server)
10
Stephen Smalley1ff64412013-10-29 14:42:40 -040011# Dalvik Compiler JIT Mapping.
12allow system_server self:process execmem;
Stephen Smalleye7ec2f52013-12-23 16:18:55 -050013allow system_server ashmem_device:chr_file execute;
14allow system_server system_server_tmpfs:file execute;
Stephen Smalley1ff64412013-10-29 14:42:40 -040015
Stephen Smalley527316a2013-12-23 14:48:02 -050016# For art.
17allow system_server dalvikcache_data_file:file execute;
18
Stephen Smalley1ff64412013-10-29 14:42:40 -040019# Child of the zygote.
20allow system_server zygote:fd use;
21allow system_server zygote:process sigchld;
22allow system_server zygote_tmpfs:file read;
23
Nick Kralevichc4d7c0d2013-12-17 12:21:17 -080024# Needed to close the zygote socket, which involves getopt / getattr
25# This should be deleted after b/12061011 is fixed
26allow system_server zygote:unix_stream_socket { getopt getattr };
27
Stephen Smalley1ff64412013-10-29 14:42:40 -040028# system server gets network and bluetooth permissions.
29net_domain(system_server)
30bluetooth_domain(system_server)
Alex Klyubin1fdee112013-09-13 15:59:04 -070031
Alex Klyubin1fdee112013-09-13 15:59:04 -070032# These are the capabilities assigned by the zygote to the
33# system server.
34allow system_server self:capability {
35 kill
36 net_admin
37 net_bind_service
38 net_broadcast
39 net_raw
40 sys_boot
41 sys_module
42 sys_nice
43 sys_resource
44 sys_time
45 sys_tty_config
46};
47
Nick Kralevich13e44ec2013-12-19 10:53:36 -080048allow system_server self:capability2 block_suspend;
49
Stephen Smalley1ff64412013-10-29 14:42:40 -040050# Triggered by /proc/pid accesses, not allowed.
51dontaudit system_server self:capability sys_ptrace;
52
53# Trigger module auto-load.
54allow system_server kernel:system module_request;
55
56# Use netlink uevent sockets.
57allow system_server self:netlink_kobject_uevent_socket *;
58
59# Kill apps.
60allow system_server appdomain:process { sigkill signal };
61
62# Set scheduling info for apps.
63allow system_server appdomain:process { getsched setsched };
64allow system_server mediaserver:process { getsched setsched };
65
66# Read /proc data for apps.
67allow system_server appdomain:dir r_dir_perms;
68allow system_server appdomain:{ file lnk_file } rw_file_perms;
69
70# Read/Write to /proc/net/xt_qtaguid/ctrl and and /dev/xt_qtaguid.
71allow system_server qtaguid_proc:file rw_file_perms;
72allow system_server qtaguid_device:chr_file rw_file_perms;
73
74# Read /sys/kernel/debug/wakeup_sources.
75allow system_server debugfs:file r_file_perms;
76
77# WifiWatchdog uses a packet_socket
78allow system_server self:packet_socket *;
79
80# 3rd party VPN clients require a tun_socket to be created
81allow system_server self:tun_socket create;
82
83# Notify init of death.
84allow system_server init:process sigchld;
85
86# Talk to init and various daemons via sockets.
87unix_socket_connect(system_server, property, init)
88unix_socket_connect(system_server, qemud, qemud)
89unix_socket_connect(system_server, installd, installd)
Nick Kralevich2b392fc2013-12-05 16:55:34 -080090unix_socket_connect(system_server, lmkd, lmkd)
Stephen Smalley1ff64412013-10-29 14:42:40 -040091unix_socket_connect(system_server, netd, netd)
92unix_socket_connect(system_server, vold, vold)
93unix_socket_connect(system_server, zygote, zygote)
94unix_socket_connect(system_server, keystore, keystore)
95unix_socket_connect(system_server, gps, gpsd)
96unix_socket_connect(system_server, racoon, racoon)
97unix_socket_send(system_server, wpa, wpa)
98
99# Communicate over a socket created by surfaceflinger.
100allow system_server surfaceflinger:unix_stream_socket { read write setopt };
101
102# Perform Binder IPC.
Stephen Smalley1ff64412013-10-29 14:42:40 -0400103binder_use(system_server)
104binder_call(system_server, binderservicedomain)
105binder_call(system_server, appdomain)
Stephen Smalley2a604ad2013-11-04 09:53:46 -0500106binder_call(system_server, healthd)
Stephen Smalley1ff64412013-10-29 14:42:40 -0400107binder_service(system_server)
108
109# Read /proc/pid files for Binder clients.
110r_dir_file(system_server, appdomain)
111r_dir_file(system_server, mediaserver)
112allow system_server appdomain:process getattr;
113allow system_server mediaserver:process getattr;
114
115# Check SELinux permissions.
116selinux_check_access(system_server)
117
118# XXX Label sysfs files with a specific type?
119allow system_server sysfs:file rw_file_perms;
120allow system_server sysfs_nfc_power_writable:file rw_file_perms;
121
122# Access devices.
123allow system_server device:dir r_dir_perms;
124allow system_server mdns_socket:sock_file rw_file_perms;
125allow system_server alarm_device:chr_file rw_file_perms;
Stephen Smalley3ba90122013-12-12 09:09:53 -0500126allow system_server gpu_device:chr_file rw_file_perms;
Stephen Smalley1ff64412013-10-29 14:42:40 -0400127allow system_server graphics_device:dir search;
128allow system_server graphics_device:chr_file rw_file_perms;
129allow system_server iio_device:chr_file rw_file_perms;
130allow system_server input_device:dir r_dir_perms;
131allow system_server input_device:chr_file rw_file_perms;
132allow system_server tty_device:chr_file rw_file_perms;
133allow system_server urandom_device:chr_file rw_file_perms;
134allow system_server usbaccessory_device:chr_file rw_file_perms;
135allow system_server video_device:chr_file rw_file_perms;
136allow system_server qemu_device:chr_file rw_file_perms;
137allow system_server adbd_socket:sock_file rw_file_perms;
138
139# tun device used for 3rd party vpn apps
140allow system_server tun_device:chr_file rw_file_perms;
141
142# Manage data files.
143allow system_server data_file_type:dir create_dir_perms;
144allow system_server data_file_type:notdevfile_class_set create_file_perms;
145
146# Read /file_contexts and /data/security/file_contexts
147security_access_policy(system_server)
148
149# Relabel apk files.
150relabelto_domain(system_server)
151allow system_server { apk_tmp_file apk_private_tmp_file }:file { relabelfrom relabelto };
152allow system_server { apk_data_file apk_private_data_file }:file { relabelfrom relabelto };
153
154# Relabel wallpaper.
155allow system_server system_data_file:file relabelfrom;
156allow system_server wallpaper_file:file relabelto;
157allow system_server wallpaper_file:file rw_file_perms;
158
159# Relabel /data/anr.
160allow system_server system_data_file:dir relabelfrom;
161allow system_server anr_data_file:dir relabelto;
162
163# Property Service write
164allow system_server system_prop:property_service set;
165allow system_server radio_prop:property_service set;
Nick Kralevichdd1ec6d2013-11-01 10:45:03 -0700166allow system_server debug_prop:property_service set;
Nick Kralevichcd95e0a2013-11-01 12:16:36 -0700167allow system_server powerctl_prop:property_service set;
Stephen Smalley1ff64412013-10-29 14:42:40 -0400168
169# ctl interface
170allow system_server ctl_default_prop:property_service set;
171
Alex Klyubin1fdee112013-09-13 15:59:04 -0700172# Create a socket for receiving info from wpa.
173type_transition system_server wifi_data_file:sock_file system_wpa_socket;
Stephen Smalley45ba6652013-09-27 10:24:49 -0400174allow system_server system_wpa_socket:sock_file create_file_perms;
175
176# Create a socket for connections from debuggerd.
177type_transition system_server system_data_file:sock_file system_ndebug_socket "ndebugsocket";
178allow system_server system_ndebug_socket:sock_file create_file_perms;
179
Stephen Smalley1ff64412013-10-29 14:42:40 -0400180# Specify any arguments to zygote.
Alex Klyubin1fdee112013-09-13 15:59:04 -0700181allow system_server self:zygote { specifyids specifyrlimits specifyseinfo };
182
Stephen Smalley1ff64412013-10-29 14:42:40 -0400183# Manage cache files.
184allow system_server cache_file:dir { relabelfrom create_dir_perms };
185allow system_server cache_file:file { relabelfrom create_file_perms };
186
187# Run system programs, e.g. dexopt.
188allow system_server system_file:file x_file_perms;
189
190# Allow reading of /proc/pid data for other domains.
191# XXX dontaudit candidate
192allow system_server domain:dir r_dir_perms;
193allow system_server domain:file r_file_perms;
194
195# LocationManager(e.g, GPS) needs to read and write
196# to uart driver and ctrl proc entry
197allow system_server gps_device:chr_file rw_file_perms;
198allow system_server gps_control:file rw_file_perms;
199
200# Allow system_server to use app-created sockets.
201allow system_server appdomain:{ tcp_socket udp_socket } { setopt read write };
202
203# Allow abstract socket connection
204allow system_server rild:unix_stream_socket connectto;
205
206# connect to vpn tunnel
207allow system_server mtp:unix_stream_socket { connectto };
208
209# BackupManagerService lets PMS create a data backup file
210allow system_server cache_backup_file:file create_file_perms;
211# Relabel /data/backup
212allow system_server backup_data_file:dir { relabelto relabelfrom };
213# Relabel /cache/.*\.{data|restore}
214allow system_server cache_backup_file:file { relabelto relabelfrom };
215# LocalTransport creates and relabels /cache/backup
216allow system_server cache_backup_file:dir { relabelto relabelfrom create_dir_perms };
217
218# Allow system to talk to usb device
219allow system_server usb_device:chr_file rw_file_perms;
220allow system_server usb_device:dir r_dir_perms;
221
222# Allow system to talk to sensors
223allow system_server sensors_device:chr_file rw_file_perms;
224
Alex Klyubin8d688312013-10-03 13:35:56 -0700225# Read from HW RNG (needed by EntropyMixer).
226allow system_server hw_random_device:chr_file r_file_perms;
227
William Robertsec7d39b2013-09-28 18:46:21 -0400228# Access to wake locks
229allow system_server sysfs_wake_lock:file rw_file_perms;
Stephen Smalleyaf47ebb2013-11-04 09:47:29 -0500230
231# Read and delete files under /dev/fscklogs.
232r_dir_file(system_server, fscklogs)
233allow system_server fscklogs:dir { write remove_name };
234allow system_server fscklogs:file unlink;
Stephen Smalleya49ba922013-12-02 14:22:17 -0500235
236# For SELinuxPolicyInstallReceiver
237selinux_manage_policy(system_server)