blob: 8ecb6cc247ac3b2a73dd83fc62aa7ef7a5979b16 [file] [log] [blame]
Nick Kralevich09e6abd2013-12-13 22:19:45 -08001# dumpstate
2type dumpstate, domain;
Nick Kralevich623975f2014-01-11 01:31:03 -08003permissive_or_unconfined(dumpstate)
Nick Kralevich09e6abd2013-12-13 22:19:45 -08004type dumpstate_exec, exec_type, file_type;
5
6init_daemon_domain(dumpstate)
7net_domain(dumpstate)
8relabelto_domain(dumpstate)
9binder_use(dumpstate)
10
11# Drop privileges by switching UID / GID
12allow dumpstate self:capability { setuid setgid };
13
14# Allow dumpstate to scan through /proc/pid for all processes
15r_dir_file(dumpstate, domain)
16
17# Send signals to processes
18allow dumpstate self:capability kill;
19
20# Allow executing files on system, such as:
21# /system/bin/toolbox
22# /system/bin/logcat
23# /system/bin/dumpsys
24allow dumpstate system_file:file execute_no_trans;
25
26# Create and write into /data/anr/
27allow dumpstate self:capability { dac_override chown fowner fsetid };
28allow dumpstate anr_data_file:dir { rw_dir_perms relabelto };
29allow dumpstate anr_data_file:file create_file_perms;
30allow dumpstate system_data_file:dir { create_dir_perms relabelfrom };
31
32# Allow reading /data/system/uiderrors.txt
33# TODO: scope this down.
34allow dumpstate system_data_file:file r_file_perms;
35
36# Read dmesg
37allow dumpstate self:capability2 syslog;
38allow dumpstate kernel:system syslog_read;
39
40# Get process attributes
41allow dumpstate domain:process getattr;
42
43# Signal java processes to dump their stack
44allow dumpstate { appdomain system_server }:process signal;
45
46# Signal native processes to dump their stack.
47# This list comes from native_processes_to_dump in dumpstate/utils.c
48allow dumpstate { drmserver mediaserver sdcardd surfaceflinger }:process signal;
49
50# The /system/bin/ip command needs this for routing table information.
51allow dumpstate self:netlink_route_socket { write getattr setopt };
52
53# The vdc command needs to talk to the vold socket.
54unix_socket_connect(dumpstate, vold, vold)
55
56# Vibrate the device after we're done collecting the bugreport
57# /sys/class/timed_output/vibrator/enable
58# TODO: create a new file class, instead of allowing write access to all of /sys
59allow dumpstate sysfs:file w_file_perms;
60
61# Other random bits of data we want to collect
62allow dumpstate qtaguid_proc:file r_file_perms;
63allow dumpstate debugfs:file r_file_perms;
64
65# Allow dumpstate to make binder calls to any binder service
66binder_call(dumpstate, binderservicedomain)
67binder_call(dumpstate, appdomain)
68
69# Reading /proc/PID/maps of other processes
70allow dumpstate self:capability sys_ptrace;
Nick Kralevichbfa3cd52014-01-05 19:20:10 -080071
72# Allow the bugreport service to create a file in
73# /data/data/com.android.shell/files/bugreports/bugreport
Stephen Smalleya5066132014-01-07 13:25:25 -050074allow dumpstate shell_data_file:dir create_dir_perms;
Nick Kralevichbfa3cd52014-01-05 19:20:10 -080075allow dumpstate shell_data_file:file create_file_perms;
Stephen Smalley208deb32014-01-29 14:56:41 -050076
77# Run a shell.
78allow dumpstate shell_exec:file rx_file_perms;
79
80# For running am and similar framework commands.
81# Run /system/bin/app_process.
82allow dumpstate zygote_exec:file rx_file_perms;
83# Dalvik Compiler JIT.
84allow dumpstate ashmem_device:chr_file execute;
85allow dumpstate dumpstate_tmpfs:file execute;
86allow dumpstate self:process execmem;
87# For art.
88allow dumpstate dalvikcache_data_file:file execute;
Mark Salyzyn8ed750e2013-11-12 15:34:52 -080089
90# logd access
91read_logd(dumpstate)
92control_logd(dumpstate)