blob: 9bc7cf6bafe7e4a070e646371af8d372337fc8a5 [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute crash_dump coredomain;
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -07002
Jeff Vander Stoep1795d0b2019-03-13 20:50:25 -07003# Crash dump does not need to access devices passed across exec().
Jeff Vander Stoep60bb29f2019-03-18 10:29:27 -07004dontaudit crash_dump { devpts dev_type }:chr_file { read write };
Jeff Vander Stoep504a6542019-02-15 10:29:38 -08005
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -07006allow crash_dump {
7 domain
Martijn Coenenac097ac2018-08-17 09:35:42 +02008 -apexd
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -07009 -bpfloader
10 -crash_dump
11 -init
12 -kernel
13 -keystore
Mark Salyzyn275ea122018-08-07 16:03:47 -070014 -llkd
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -070015 -logd
16 -ueventd
17 -vendor_init
18 -vold
19}:process { ptrace signal sigchld sigstop sigkill };
Max Biresf0939162021-04-30 11:08:07 -070020
Mark Salyzyn275ea122018-08-07 16:03:47 -070021userdebug_or_eng(`
Max Biresf0939162021-04-30 11:08:07 -070022 allow crash_dump {
23 apexd
24 keystore
25 llkd
26 logd
27 vold
28 }:process { ptrace signal sigchld sigstop sigkill };
Mark Salyzyn275ea122018-08-07 16:03:47 -070029')
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -070030
Ryan Savitski941ba722023-02-02 14:24:45 +000031# Read ART APEX data directory
32allow crash_dump apex_art_data_file:dir { getattr search };
33allow crash_dump apex_art_data_file:file r_file_perms;
34
Steven Moreland91497cc2023-12-06 01:42:29 +000035# Allow crash dump to read bootstrap libraries
36allow crash_dump system_bootstrap_lib_file:dir { getattr search };
37allow crash_dump system_bootstrap_lib_file:file r_file_perms;
38
Jooyung Han18a42af2023-09-05 17:51:38 +090039# Read Vendor APEX directories
40allow crash_dump vendor_apex_metadata_file:dir { getattr search };
41
Inseob Kim75806ef2024-03-27 17:18:41 +090042# crash_dump might inherit CAP_SYS_PTRACE from a privileged process,
43# which will result in an audit log even when it's allowed to trace.
44dontaudit crash_dump self:global_capability_class_set { sys_ptrace };
45
46userdebug_or_eng(`
47 allow crash_dump logd:process { ptrace signal sigchld sigstop sigkill };
48
49 # Let crash_dump write to /dev/kmsg_debug crashes that happen before logd comes up.
50 allow crash_dump kmsg_debug_device:chr_file { open append };
51')
52
53# Use inherited file descriptors
54allow crash_dump domain:fd use;
55
56# Read/write IPC pipes inherited from crashing processes.
57allow crash_dump domain:fifo_file { read write };
58
59# Append to pipes given to us by processes requesting dumps (e.g. dumpstate)
60allow crash_dump domain:fifo_file { append };
61
62# Read information from /proc/$PID.
63allow crash_dump domain:process getattr;
64
65r_dir_file(crash_dump, domain)
66allow crash_dump exec_type:file r_file_perms;
67
68# Read /data/dalvik-cache.
69allow crash_dump dalvikcache_data_file:dir { search getattr };
70allow crash_dump dalvikcache_data_file:file r_file_perms;
71
72# Read APEX data directories.
73allow crash_dump apex_module_data_file:dir { getattr search };
74
75# Read uptime
76allow crash_dump proc_uptime:file r_file_perms;
77
78# Read APK files.
79r_dir_file(crash_dump, apk_data_file);
80
81# Read all /vendor
82r_dir_file(crash_dump, { vendor_file same_process_hal_file })
83
84# Read all /data/local/tests
85r_dir_file(crash_dump, shell_test_data_file)
86
87# Talk to tombstoned
88unix_socket_connect(crash_dump, tombstoned_crash, tombstoned)
89
90# Talk to ActivityManager.
91unix_socket_connect(crash_dump, system_ndebug, system_server)
92
93# Append to ANR files.
94allow crash_dump anr_data_file:file { append getattr };
95
96# Append to tombstone files.
97allow crash_dump tombstone_data_file:file { append getattr };
98
99# crash_dump writes out logcat logs at the bottom of tombstones,
100# which is super useful in some cases.
101unix_socket_connect(crash_dump, logdr, logd)
102
103# Crash dump is not intended to access the following files. Since these
104# are WAI, suppress the denials to clean up the logs.
105dontaudit crash_dump {
106 core_data_file_type
107 vendor_file_type
108}:dir search;
109dontaudit crash_dump system_data_file:{ lnk_file file } read;
110dontaudit crash_dump property_type:file read;
111
Nick Kralevich095fbea2018-09-13 11:07:14 -0700112###
113### neverallow assertions
114###
115
Inseob Kim75806ef2024-03-27 17:18:41 +0900116# A domain transition must occur for crash_dump to get the privileges needed to trace the process.
117# Do not allow the execution of crash_dump without a domain transition.
118neverallow domain crash_dump_exec:file execute_no_trans;
119
Ryan Savitski941ba722023-02-02 14:24:45 +0000120# sigchld not explicitly forbidden since it's part of the
121# domain-transition-on-exec macros, and is by itself not sensitive
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -0700122neverallow crash_dump {
Andreas Gampeefece542019-03-05 08:36:36 -0800123 apexd
124 userdebug_or_eng(`-apexd')
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -0700125 bpfloader
126 init
127 kernel
128 keystore
Max Biresf0939162021-04-30 11:08:07 -0700129 userdebug_or_eng(`-keystore')
Mark Salyzyn275ea122018-08-07 16:03:47 -0700130 llkd
131 userdebug_or_eng(`-llkd')
Jeff Vander Stoep08aa7152018-06-13 22:10:37 -0700132 logd
133 userdebug_or_eng(`-logd')
134 ueventd
135 vendor_init
136 vold
Jeff Sharkeyd1018962019-02-05 14:39:02 -0700137 userdebug_or_eng(`-vold')
Ryan Savitski941ba722023-02-02 14:24:45 +0000138}:process { ptrace signal sigstop sigkill };
Alan Stokesb9cb73a2018-09-03 17:27:54 +0100139
140neverallow crash_dump self:process ptrace;
Jeff Vander Stoep504a6542019-02-15 10:29:38 -0800141neverallow crash_dump gpu_device:chr_file *;