• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1type crash_dump, domain;
2type crash_dump_exec, system_file_type, 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
49# crash_dump writes out logcat logs at the bottom of tombstones,
50# which is super useful in some cases.
51unix_socket_connect(crash_dump, logdr, logd)
52
53# Crash dump is not intended to access the following files. Since these
54# are WAI, suppress the denials to clean up the logs.
55dontaudit crash_dump {
56  core_data_file_type
57  vendor_file_type
58}:dir search;
59dontaudit crash_dump system_data_file:file read;
60dontaudit crash_dump property_type:file read;
61
62###
63### neverallow assertions
64###
65
66# A domain transition must occur for crash_dump to get the privileges needed to trace the process.
67# Do not allow the execution of crash_dump without a domain transition.
68neverallow domain crash_dump_exec:file execute_no_trans;
69