blob: 82691d3a3fd8e8373e49cac6879f8a3a46927482 [file] [log] [blame]
yro5744cbd2017-12-11 15:30:12 -08001type statsd, domain;
2typeattribute statsd coredomain;
3
4init_daemon_domain(statsd)
5
6type statsd_exec, exec_type, file_type;
7binder_use(statsd)
8
9# Allow statsd to scan through /proc/pid for all processes.
10r_dir_file(statsd, domain)
11
12# Allow executing files on system, such as running a shell or running:
13# /system/bin/toolbox
14# /system/bin/logcat
15# /system/bin/dumpsys
16allow statsd shell_exec:file rx_file_perms;
17allow statsd system_file:file execute_no_trans;
18allow statsd toolbox_exec:file rx_file_perms;
19
20# Create, read, and write into /data/misc/stats-data, /data/misc/stats-system.
21allow statsd stats_data_file:dir create_dir_perms;
22allow statsd stats_data_file:file create_file_perms;
23
24# Allow statsd to make binder calls to any binder service.
25binder_call(statsd, appdomain)
26binder_call(statsd, incidentd)
27binder_call(statsd, statscompanion_service)
28
29# Allow logd access.
30read_logd(statsd)
31control_logd(statsd)
32
33# Grant statsd with permissions to register the services.
34allow statsd {
35 statscompanion_service
36 app_api_service
37 system_api_service
38}:service_manager find;
39
40# Only statsd can publish the binder service.
41add_service(statsd, stats_service)
42
43# Allow pipes from (and only from) stats.
44allow statsd stats:fd use;
45allow statsd stats:fifo_file write;
46
47# Allow statsd to call back to stats with status updates.
48binder_call(statsd, stats)
49
50###
51### neverallow rules
52###
53
54# Only system_server, system_app, and stats command can find the stats service.
55neverallow {
56 domain
57 -dumpstate
58 -shell
59 -stats
60 -statsd
61 -system_app
62 -system_server
63} stats_service:service_manager find;
64
65# Only statsd and the other root services in limited circumstances.
66# can get to the files in /data/misc/stats-data, /data/misc/stats-service.
67# Other services are prohibitted from accessing the file.
68neverallow { domain -statsd -init -vold -vendor_init } stats_data_file:file *;
69
70# Limited access to the directory itself.
71neverallow { domain -statsd -init -vold -vendor_init } stats_data_file:dir *;
72