1# debugger interface
2type debuggerd, domain;
3type debuggerd_exec, exec_type, file_type;
4
5init_daemon_domain(debuggerd)
6typeattribute debuggerd mlstrustedsubject;
7allow debuggerd self:capability { dac_override sys_ptrace chown kill fowner };
8allow debuggerd self:capability2 { syslog };
9allow debuggerd domain:dir r_dir_perms;
10allow debuggerd domain:file r_file_perms;
11allow debuggerd domain:lnk_file read;
12allow debuggerd { domain -init -ueventd -watchdogd -healthd -adbd -keystore }:process { ptrace getattr };
13security_access_policy(debuggerd)
14allow debuggerd system_data_file:dir create_dir_perms;
15allow debuggerd system_data_file:dir relabelfrom;
16allow debuggerd tombstone_data_file:dir relabelto;
17allow debuggerd tombstone_data_file:dir create_dir_perms;
18allow debuggerd tombstone_data_file:file create_file_perms;
19allow debuggerd shared_relro_file:dir r_dir_perms;
20allow debuggerd shared_relro_file:file r_file_perms;
21allow debuggerd domain:process { sigstop signal };
22allow debuggerd exec_type:file r_file_perms;
23# Access app library
24allow debuggerd system_data_file:file open;
25# Allow debuggerd to redirect a dump_backtrace request to itself.
26# This only happens on 64 bit systems, where all requests go to the 64 bit
27# debuggerd and get redirected to the 32 bit debuggerd if the process is 32 bit.
28allow debuggerd { drmserver mediaserver sdcardd surfaceflinger inputflinger }:debuggerd dump_backtrace;
29
30# Connect to system_server via /data/system/ndebugsocket.
31unix_socket_connect(debuggerd, system_ndebug, system_server)
32
33userdebug_or_eng(`
34  allow debuggerd input_device:dir r_dir_perms;
35  allow debuggerd input_device:chr_file rw_file_perms;
36')
37
38# logd access
39read_logd(debuggerd)
40
41# Check SELinux permissions.
42selinux_check_access(debuggerd)
43