blob: 584b1406f1c08f4b2804751aac947ac8e7bb85cd [file] [log] [blame]
Nick Kralevich09e6abd2013-12-13 22:19:45 -08001# dumpstate
Stephen Smalleycbc52792014-09-11 15:51:28 -04002type dumpstate, domain, mlstrustedsubject;
Nick Kralevich09e6abd2013-12-13 22:19:45 -08003type dumpstate_exec, exec_type, file_type;
4
5init_daemon_domain(dumpstate)
6net_domain(dumpstate)
Nick Kralevich09e6abd2013-12-13 22:19:45 -08007binder_use(dumpstate)
8
Christopher Ferris5ec38c42015-01-29 12:11:55 -08009# Allow setting process priority, protect from OOM killer, and dropping
10# privileges by switching UID / GID
11allow dumpstate self:capability { setuid setgid sys_resource };
Nick Kralevich09e6abd2013-12-13 22:19:45 -080012
13# Allow dumpstate to scan through /proc/pid for all processes
14r_dir_file(dumpstate, domain)
15
16# Send signals to processes
17allow dumpstate self:capability kill;
18
19# Allow executing files on system, such as:
20# /system/bin/toolbox
21# /system/bin/logcat
22# /system/bin/dumpsys
23allow dumpstate system_file:file execute_no_trans;
24
25# Create and write into /data/anr/
26allow dumpstate self:capability { dac_override chown fowner fsetid };
27allow dumpstate anr_data_file:dir { rw_dir_perms relabelto };
28allow dumpstate anr_data_file:file create_file_perms;
29allow dumpstate system_data_file:dir { create_dir_perms relabelfrom };
30
31# Allow reading /data/system/uiderrors.txt
32# TODO: scope this down.
33allow dumpstate system_data_file:file r_file_perms;
34
35# Read dmesg
36allow dumpstate self:capability2 syslog;
37allow dumpstate kernel:system syslog_read;
38
Nick Kralevicha8281ad2014-06-09 13:19:36 -070039# Read /sys/fs/pstore/console-ramoops
40allow dumpstate pstorefs:dir r_dir_perms;
41allow dumpstate pstorefs:file r_file_perms;
42
Nick Kralevich09e6abd2013-12-13 22:19:45 -080043# Get process attributes
44allow dumpstate domain:process getattr;
45
46# Signal java processes to dump their stack
47allow dumpstate { appdomain system_server }:process signal;
48
49# Signal native processes to dump their stack.
50# This list comes from native_processes_to_dump in dumpstate/utils.c
51allow dumpstate { drmserver mediaserver sdcardd surfaceflinger }:process signal;
Stephen Smalley77a236c2014-08-01 10:15:24 -040052# Ask debuggerd for the backtraces of these processes.
53allow dumpstate { drmserver mediaserver sdcardd surfaceflinger }:debuggerd dump_backtrace;
Nick Kralevich09e6abd2013-12-13 22:19:45 -080054
Nick Kralevichc0d14762014-06-25 12:30:11 -070055# Execute and transition to the vdc domain
56domain_auto_trans(dumpstate, vdc_exec, vdc)
Nick Kralevich09e6abd2013-12-13 22:19:45 -080057
58# Vibrate the device after we're done collecting the bugreport
59# /sys/class/timed_output/vibrator/enable
60# TODO: create a new file class, instead of allowing write access to all of /sys
61allow dumpstate sysfs:file w_file_perms;
62
63# Other random bits of data we want to collect
64allow dumpstate qtaguid_proc:file r_file_perms;
65allow dumpstate debugfs:file r_file_perms;
Nick Kralevichc24d90c2015-04-06 15:24:51 -070066# df for /storage/emulated needs search
67allow dumpstate storage_file:dir search;
Nick Kralevich09e6abd2013-12-13 22:19:45 -080068
69# Allow dumpstate to make binder calls to any binder service
70binder_call(dumpstate, binderservicedomain)
71binder_call(dumpstate, appdomain)
72
73# Reading /proc/PID/maps of other processes
74allow dumpstate self:capability sys_ptrace;
Nick Kralevichbfa3cd52014-01-05 19:20:10 -080075
76# Allow the bugreport service to create a file in
77# /data/data/com.android.shell/files/bugreports/bugreport
Stephen Smalleya5066132014-01-07 13:25:25 -050078allow dumpstate shell_data_file:dir create_dir_perms;
Nick Kralevichbfa3cd52014-01-05 19:20:10 -080079allow dumpstate shell_data_file:file create_file_perms;
Stephen Smalley208deb32014-01-29 14:56:41 -050080
81# Run a shell.
82allow dumpstate shell_exec:file rx_file_perms;
83
84# For running am and similar framework commands.
85# Run /system/bin/app_process.
86allow dumpstate zygote_exec:file rx_file_perms;
87# Dalvik Compiler JIT.
88allow dumpstate ashmem_device:chr_file execute;
89allow dumpstate dumpstate_tmpfs:file execute;
90allow dumpstate self:process execmem;
91# For art.
92allow dumpstate dalvikcache_data_file:file execute;
Kazuki Nakayama9103c972015-03-23 16:31:13 +090093allow dumpstate dalvikcache_data_file:lnk_file r_file_perms;
Mark Salyzyn8ed750e2013-11-12 15:34:52 -080094
Nick Kralevichb2ed0442014-06-09 12:51:42 -070095# Dumpstate calls screencap, which grabs a screenshot. Needs gpu access
96allow dumpstate gpu_device:chr_file rw_file_perms;
97
Mark Salyzyn8ed750e2013-11-12 15:34:52 -080098# logd access
99read_logd(dumpstate)
100control_logd(dumpstate)
Sreeram Ramachandrand2d172a2014-07-08 15:46:52 -0700101
102# Read network state info files.
103allow dumpstate net_data_file:dir search;
104allow dumpstate net_data_file:file r_file_perms;
Riley Spahn603bc202014-07-18 09:24:13 -0700105
Christopher Ferrisb2eaa282014-07-22 18:39:04 -0700106# Access /data/tombstones.
107allow dumpstate tombstone_data_file:dir r_dir_perms;
108allow dumpstate tombstone_data_file:file r_file_perms;
109
Andres Moralese2079862015-04-03 16:46:33 -0700110allow dumpstate { service_manager_type -gatekeeper_service }:service_manager find;
dcashman0780f302014-12-30 15:21:50 -0800111allow dumpstate servicemanager:service_manager list;
Christopher Ferris5ec38c42015-01-29 12:11:55 -0800112
113allow dumpstate devpts:chr_file rw_file_perms;