2013-12-14 07:19:45 +01:00
|
|
|
# dumpstate
|
2015-11-03 18:54:39 +01:00
|
|
|
type dumpstate, domain, domain_deprecated, mlstrustedsubject;
|
2013-12-14 07:19:45 +01:00
|
|
|
type dumpstate_exec, exec_type, file_type;
|
|
|
|
|
|
|
|
init_daemon_domain(dumpstate)
|
|
|
|
net_domain(dumpstate)
|
|
|
|
binder_use(dumpstate)
|
|
|
|
|
2015-01-29 21:11:55 +01:00
|
|
|
# Allow setting process priority, protect from OOM killer, and dropping
|
|
|
|
# privileges by switching UID / GID
|
|
|
|
allow dumpstate self:capability { setuid setgid sys_resource };
|
2013-12-14 07:19:45 +01:00
|
|
|
|
|
|
|
# Allow dumpstate to scan through /proc/pid for all processes
|
|
|
|
r_dir_file(dumpstate, domain)
|
|
|
|
|
|
|
|
# Send signals to processes
|
|
|
|
allow dumpstate self:capability kill;
|
|
|
|
|
|
|
|
# Allow executing files on system, such as:
|
|
|
|
# /system/bin/toolbox
|
|
|
|
# /system/bin/logcat
|
|
|
|
# /system/bin/dumpsys
|
|
|
|
allow dumpstate system_file:file execute_no_trans;
|
2015-08-25 17:38:29 +02:00
|
|
|
allow dumpstate toolbox_exec:file rx_file_perms;
|
2013-12-14 07:19:45 +01:00
|
|
|
|
|
|
|
# Create and write into /data/anr/
|
|
|
|
allow dumpstate self:capability { dac_override chown fowner fsetid };
|
2015-08-13 02:01:57 +02:00
|
|
|
allow dumpstate anr_data_file:dir rw_dir_perms;
|
2013-12-14 07:19:45 +01:00
|
|
|
allow dumpstate anr_data_file:file create_file_perms;
|
|
|
|
|
|
|
|
# Allow reading /data/system/uiderrors.txt
|
|
|
|
# TODO: scope this down.
|
|
|
|
allow dumpstate system_data_file:file r_file_perms;
|
|
|
|
|
|
|
|
# Read dmesg
|
|
|
|
allow dumpstate self:capability2 syslog;
|
|
|
|
allow dumpstate kernel:system syslog_read;
|
|
|
|
|
2014-06-09 22:19:36 +02:00
|
|
|
# Read /sys/fs/pstore/console-ramoops
|
|
|
|
allow dumpstate pstorefs:dir r_dir_perms;
|
|
|
|
allow dumpstate pstorefs:file r_file_perms;
|
|
|
|
|
2013-12-14 07:19:45 +01:00
|
|
|
# Get process attributes
|
|
|
|
allow dumpstate domain:process getattr;
|
|
|
|
|
|
|
|
# Signal java processes to dump their stack
|
2015-11-25 18:41:05 +01:00
|
|
|
allow dumpstate { appdomain autoplay_app system_server }:process signal;
|
2013-12-14 07:19:45 +01:00
|
|
|
|
|
|
|
# Signal native processes to dump their stack.
|
|
|
|
# This list comes from native_processes_to_dump in dumpstate/utils.c
|
2016-05-12 03:40:27 +02:00
|
|
|
allow dumpstate {
|
|
|
|
audioserver
|
|
|
|
cameraserver
|
|
|
|
drmserver
|
|
|
|
inputflinger
|
|
|
|
mediacodec
|
|
|
|
mediadrmserver
|
|
|
|
mediaextractor
|
|
|
|
mediaserver
|
|
|
|
sdcardd
|
|
|
|
surfaceflinger
|
|
|
|
}:process signal;
|
2014-08-01 16:15:24 +02:00
|
|
|
# Ask debuggerd for the backtraces of these processes.
|
2016-05-12 03:40:27 +02:00
|
|
|
allow dumpstate {
|
|
|
|
audioserver
|
|
|
|
cameraserver
|
|
|
|
drmserver
|
|
|
|
inputflinger
|
|
|
|
mediacodec
|
|
|
|
mediadrmserver
|
|
|
|
mediaextractor
|
|
|
|
mediaserver
|
|
|
|
sdcardd
|
|
|
|
surfaceflinger
|
|
|
|
}:debuggerd dump_backtrace;
|
2013-12-14 07:19:45 +01:00
|
|
|
|
2014-06-25 21:30:11 +02:00
|
|
|
# Execute and transition to the vdc domain
|
|
|
|
domain_auto_trans(dumpstate, vdc_exec, vdc)
|
2013-12-14 07:19:45 +01:00
|
|
|
|
|
|
|
# Vibrate the device after we're done collecting the bugreport
|
|
|
|
# /sys/class/timed_output/vibrator/enable
|
|
|
|
# TODO: create a new file class, instead of allowing write access to all of /sys
|
|
|
|
allow dumpstate sysfs:file w_file_perms;
|
|
|
|
|
2016-06-14 22:41:47 +02:00
|
|
|
# TODO: added to match above sysfs rule. Remove me?
|
|
|
|
allow dumpstate sysfs_usb:file w_file_perms;
|
|
|
|
|
2013-12-14 07:19:45 +01:00
|
|
|
# Other random bits of data we want to collect
|
|
|
|
allow dumpstate qtaguid_proc:file r_file_perms;
|
|
|
|
allow dumpstate debugfs:file r_file_perms;
|
2015-04-07 00:24:51 +02:00
|
|
|
# df for /storage/emulated needs search
|
2015-12-10 01:27:36 +01:00
|
|
|
allow dumpstate { storage_file block_device }:dir { search getattr };
|
|
|
|
allow dumpstate fuse_device:chr_file getattr;
|
|
|
|
allow dumpstate { dm_device cache_block_device }:blk_file getattr;
|
2013-12-14 07:19:45 +01:00
|
|
|
|
|
|
|
# Allow dumpstate to make binder calls to any binder service
|
|
|
|
binder_call(dumpstate, binderservicedomain)
|
2016-04-19 01:05:44 +02:00
|
|
|
binder_call(dumpstate, { appdomain autoplay_app netd })
|
|
|
|
|
2013-12-14 07:19:45 +01:00
|
|
|
|
|
|
|
# Reading /proc/PID/maps of other processes
|
|
|
|
allow dumpstate self:capability sys_ptrace;
|
2014-01-06 04:20:10 +01:00
|
|
|
|
|
|
|
# Allow the bugreport service to create a file in
|
|
|
|
# /data/data/com.android.shell/files/bugreports/bugreport
|
2014-01-07 19:25:25 +01:00
|
|
|
allow dumpstate shell_data_file:dir create_dir_perms;
|
2014-01-06 04:20:10 +01:00
|
|
|
allow dumpstate shell_data_file:file create_file_perms;
|
2014-01-29 20:56:41 +01:00
|
|
|
|
|
|
|
# Run a shell.
|
|
|
|
allow dumpstate shell_exec:file rx_file_perms;
|
|
|
|
|
|
|
|
# For running am and similar framework commands.
|
|
|
|
# Run /system/bin/app_process.
|
|
|
|
allow dumpstate zygote_exec:file rx_file_perms;
|
|
|
|
# Dalvik Compiler JIT.
|
|
|
|
allow dumpstate ashmem_device:chr_file execute;
|
|
|
|
allow dumpstate dumpstate_tmpfs:file execute;
|
|
|
|
allow dumpstate self:process execmem;
|
|
|
|
# For art.
|
|
|
|
allow dumpstate dalvikcache_data_file:file execute;
|
2015-03-23 08:31:13 +01:00
|
|
|
allow dumpstate dalvikcache_data_file:lnk_file r_file_perms;
|
2013-11-13 00:34:52 +01:00
|
|
|
|
2014-06-09 21:51:42 +02:00
|
|
|
# Dumpstate calls screencap, which grabs a screenshot. Needs gpu access
|
|
|
|
allow dumpstate gpu_device:chr_file rw_file_perms;
|
|
|
|
|
2013-11-13 00:34:52 +01:00
|
|
|
# logd access
|
|
|
|
read_logd(dumpstate)
|
|
|
|
control_logd(dumpstate)
|
2014-07-09 00:46:52 +02:00
|
|
|
|
|
|
|
# Read network state info files.
|
|
|
|
allow dumpstate net_data_file:dir search;
|
|
|
|
allow dumpstate net_data_file:file r_file_perms;
|
2014-07-18 18:24:13 +02:00
|
|
|
|
2014-07-23 03:39:04 +02:00
|
|
|
# Access /data/tombstones.
|
|
|
|
allow dumpstate tombstone_data_file:dir r_dir_perms;
|
|
|
|
allow dumpstate tombstone_data_file:file r_file_perms;
|
|
|
|
|
2015-12-22 21:37:17 +01:00
|
|
|
# Access /cache/recovery
|
|
|
|
allow dumpstate cache_recovery_file:dir r_dir_perms;
|
|
|
|
allow dumpstate cache_recovery_file:file r_file_perms;
|
|
|
|
|
2016-03-25 21:34:11 +01:00
|
|
|
# Access /data/misc/recovery
|
|
|
|
allow dumpstate recovery_data_file:dir r_dir_perms;
|
|
|
|
allow dumpstate recovery_data_file:file r_file_perms;
|
|
|
|
|
2016-04-01 18:58:39 +02:00
|
|
|
# Access /data/misc/logd
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow dumpstate misc_logd_file:dir r_dir_perms;
|
|
|
|
allow dumpstate misc_logd_file:file r_file_perms;
|
|
|
|
')
|
|
|
|
|
2016-04-19 01:05:44 +02:00
|
|
|
allow dumpstate { service_manager_type -gatekeeper_service }:service_manager find;
|
2014-12-31 00:21:50 +01:00
|
|
|
allow dumpstate servicemanager:service_manager list;
|
2015-01-29 21:11:55 +01:00
|
|
|
|
|
|
|
allow dumpstate devpts:chr_file rw_file_perms;
|
2015-12-02 03:03:05 +01:00
|
|
|
|
|
|
|
# Set properties.
|
|
|
|
# dumpstate_prop is used to share state with the Shell app.
|
|
|
|
set_prop(dumpstate, dumpstate_prop)
|
2016-03-18 00:08:21 +01:00
|
|
|
|
|
|
|
# systrace support - allow atrace to run
|
|
|
|
allow dumpstate debugfs_tracing:dir r_dir_perms;
|
|
|
|
allow dumpstate debugfs_tracing:file rw_file_perms;
|
|
|
|
allow dumpstate debugfs_trace_marker:file getattr;
|
|
|
|
allow dumpstate atrace_exec:file rx_file_perms;
|
2016-04-05 19:34:53 +02:00
|
|
|
|
|
|
|
# Access to /data/media.
|
|
|
|
# This should be removed if sdcardfs is modified to alter the secontext for its
|
|
|
|
# accesses to the underlying FS.
|
|
|
|
allow dumpstate media_rw_data_file:dir getattr;
|