1type crash_dump, domain;
2type crash_dump_exec, exec_type, file_type;
3
4# crash_dump might inherit CAP_SYS_PTRACE from a privileged process,
5# which will result in an audit log even when it's allowed to trace.
6dontaudit crash_dump self:global_capability_class_set { sys_ptrace };
7
8userdebug_or_eng(`
9  allow crash_dump logd:process { ptrace signal sigchld sigstop sigkill };
10
11  # Let crash_dump write to /dev/kmsg_debug crashes that happen before logd comes up.
12  allow crash_dump kmsg_debug_device:chr_file { open append };
13')
14
15# Use inherited file descriptors
16allow crash_dump domain:fd use;
17
18# Read/write IPC pipes inherited from crashing processes.
19allow crash_dump domain:fifo_file { read write };
20
21# Append to pipes given to us by processes requesting dumps (e.g. dumpstate)
22allow crash_dump domain:fifo_file { append };
23
24r_dir_file(crash_dump, domain)
25allow crash_dump exec_type:file r_file_perms;
26
27# Read /data/dalvik-cache.
28allow crash_dump dalvikcache_data_file:dir { search getattr };
29allow crash_dump dalvikcache_data_file:file r_file_perms;
30
31# Read APK files.
32r_dir_file(crash_dump, apk_data_file);
33
34# Read all /vendor
35r_dir_file(crash_dump, { vendor_file same_process_hal_file })
36
37# Talk to tombstoned
38unix_socket_connect(crash_dump, tombstoned_crash, tombstoned)
39
40# Talk to ActivityManager.
41unix_socket_connect(crash_dump, system_ndebug, system_server)
42
43# Append to ANR files.
44allow crash_dump anr_data_file:file { append getattr };
45
46# Append to tombstone files.
47allow crash_dump tombstone_data_file:file { append getattr };
48
49read_logd(crash_dump)
50
51# Crash dump is not intended to access the following data types. Since these
52# are WAI, suppress the denials to clean up the logs.
53dontaudit crash_dump {
54  core_data_file_type
55  vendor_file_type
56}:dir search;
57dontaudit crash_dump system_data_file:file read;
58
59###
60### neverallow assertions
61###
62
63# A domain transition must occur for crash_dump to get the privileges needed to trace the process.
64# Do not allow the execution of crash_dump without a domain transition.
65neverallow domain crash_dump_exec:file execute_no_trans;
66