2017-03-23 22:27:32 +01:00
|
|
|
typeattribute crash_dump coredomain;
|
2018-06-14 07:10:37 +02:00
|
|
|
|
2019-03-14 04:50:25 +01:00
|
|
|
# Crash dump does not need to access devices passed across exec().
|
2019-03-18 18:29:27 +01:00
|
|
|
dontaudit crash_dump { devpts dev_type }:chr_file { read write };
|
2019-02-15 19:29:38 +01:00
|
|
|
|
2018-06-14 07:10:37 +02:00
|
|
|
allow crash_dump {
|
|
|
|
domain
|
2018-08-17 09:35:42 +02:00
|
|
|
-apexd
|
2018-06-14 07:10:37 +02:00
|
|
|
-bpfloader
|
|
|
|
-crash_dump
|
|
|
|
-init
|
|
|
|
-kernel
|
|
|
|
-keystore
|
2018-08-08 01:03:47 +02:00
|
|
|
-llkd
|
2018-06-14 07:10:37 +02:00
|
|
|
-logd
|
|
|
|
-ueventd
|
|
|
|
-vendor_init
|
|
|
|
-vold
|
|
|
|
}:process { ptrace signal sigchld sigstop sigkill };
|
2021-04-30 20:08:07 +02:00
|
|
|
|
2018-08-08 01:03:47 +02:00
|
|
|
userdebug_or_eng(`
|
2021-04-30 20:08:07 +02:00
|
|
|
allow crash_dump {
|
|
|
|
apexd
|
|
|
|
keystore
|
|
|
|
llkd
|
|
|
|
logd
|
|
|
|
vold
|
|
|
|
}:process { ptrace signal sigchld sigstop sigkill };
|
2018-08-08 01:03:47 +02:00
|
|
|
')
|
2018-06-14 07:10:37 +02:00
|
|
|
|
2023-02-02 15:24:45 +01:00
|
|
|
# Read ART APEX data directory
|
|
|
|
allow crash_dump apex_art_data_file:dir { getattr search };
|
|
|
|
allow crash_dump apex_art_data_file:file r_file_perms;
|
|
|
|
|
2023-12-06 02:42:29 +01:00
|
|
|
# Allow crash dump to read bootstrap libraries
|
|
|
|
allow crash_dump system_bootstrap_lib_file:dir { getattr search };
|
|
|
|
allow crash_dump system_bootstrap_lib_file:file r_file_perms;
|
|
|
|
|
2023-09-05 10:51:38 +02:00
|
|
|
# Read Vendor APEX directories
|
|
|
|
allow crash_dump vendor_apex_metadata_file:dir { getattr search };
|
|
|
|
|
2024-03-27 09:18:41 +01:00
|
|
|
# crash_dump might inherit CAP_SYS_PTRACE from a privileged process,
|
|
|
|
# which will result in an audit log even when it's allowed to trace.
|
|
|
|
dontaudit crash_dump self:global_capability_class_set { sys_ptrace };
|
|
|
|
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow crash_dump logd:process { ptrace signal sigchld sigstop sigkill };
|
|
|
|
|
|
|
|
# Let crash_dump write to /dev/kmsg_debug crashes that happen before logd comes up.
|
|
|
|
allow crash_dump kmsg_debug_device:chr_file { open append };
|
|
|
|
')
|
|
|
|
|
|
|
|
# Use inherited file descriptors
|
|
|
|
allow crash_dump domain:fd use;
|
|
|
|
|
|
|
|
# Read/write IPC pipes inherited from crashing processes.
|
|
|
|
allow crash_dump domain:fifo_file { read write };
|
|
|
|
|
|
|
|
# Append to pipes given to us by processes requesting dumps (e.g. dumpstate)
|
|
|
|
allow crash_dump domain:fifo_file { append };
|
|
|
|
|
|
|
|
# Read information from /proc/$PID.
|
|
|
|
allow crash_dump domain:process getattr;
|
|
|
|
|
|
|
|
r_dir_file(crash_dump, domain)
|
|
|
|
allow crash_dump exec_type:file r_file_perms;
|
|
|
|
|
|
|
|
# Read /data/dalvik-cache.
|
|
|
|
allow crash_dump dalvikcache_data_file:dir { search getattr };
|
|
|
|
allow crash_dump dalvikcache_data_file:file r_file_perms;
|
|
|
|
|
|
|
|
# Read APEX data directories.
|
|
|
|
allow crash_dump apex_module_data_file:dir { getattr search };
|
|
|
|
|
|
|
|
# Read uptime
|
|
|
|
allow crash_dump proc_uptime:file r_file_perms;
|
|
|
|
|
|
|
|
# Read APK files.
|
|
|
|
r_dir_file(crash_dump, apk_data_file);
|
|
|
|
|
|
|
|
# Read all /vendor
|
|
|
|
r_dir_file(crash_dump, { vendor_file same_process_hal_file })
|
|
|
|
|
|
|
|
# Read all /data/local/tests
|
|
|
|
r_dir_file(crash_dump, shell_test_data_file)
|
|
|
|
|
|
|
|
# Talk to tombstoned
|
|
|
|
unix_socket_connect(crash_dump, tombstoned_crash, tombstoned)
|
|
|
|
|
|
|
|
# Talk to ActivityManager.
|
|
|
|
unix_socket_connect(crash_dump, system_ndebug, system_server)
|
|
|
|
|
|
|
|
# Append to ANR files.
|
|
|
|
allow crash_dump anr_data_file:file { append getattr };
|
|
|
|
|
|
|
|
# Append to tombstone files.
|
|
|
|
allow crash_dump tombstone_data_file:file { append getattr };
|
|
|
|
|
|
|
|
# crash_dump writes out logcat logs at the bottom of tombstones,
|
|
|
|
# which is super useful in some cases.
|
|
|
|
unix_socket_connect(crash_dump, logdr, logd)
|
|
|
|
|
|
|
|
# Crash dump is not intended to access the following files. Since these
|
|
|
|
# are WAI, suppress the denials to clean up the logs.
|
|
|
|
dontaudit crash_dump {
|
|
|
|
core_data_file_type
|
|
|
|
vendor_file_type
|
|
|
|
}:dir search;
|
|
|
|
dontaudit crash_dump system_data_file:{ lnk_file file } read;
|
|
|
|
dontaudit crash_dump property_type:file read;
|
|
|
|
|
2024-05-04 02:50:52 +02:00
|
|
|
get_prop(crash_dump, misctrl_prop)
|
|
|
|
|
2018-09-13 20:07:14 +02:00
|
|
|
###
|
|
|
|
### neverallow assertions
|
|
|
|
###
|
|
|
|
|
2024-03-27 09:18:41 +01:00
|
|
|
# A domain transition must occur for crash_dump to get the privileges needed to trace the process.
|
|
|
|
# Do not allow the execution of crash_dump without a domain transition.
|
|
|
|
neverallow domain crash_dump_exec:file execute_no_trans;
|
|
|
|
|
2023-02-02 15:24:45 +01:00
|
|
|
# sigchld not explicitly forbidden since it's part of the
|
|
|
|
# domain-transition-on-exec macros, and is by itself not sensitive
|
2018-06-14 07:10:37 +02:00
|
|
|
neverallow crash_dump {
|
2019-03-05 17:36:36 +01:00
|
|
|
apexd
|
|
|
|
userdebug_or_eng(`-apexd')
|
2018-06-14 07:10:37 +02:00
|
|
|
bpfloader
|
|
|
|
init
|
|
|
|
kernel
|
|
|
|
keystore
|
2021-04-30 20:08:07 +02:00
|
|
|
userdebug_or_eng(`-keystore')
|
2018-08-08 01:03:47 +02:00
|
|
|
llkd
|
|
|
|
userdebug_or_eng(`-llkd')
|
2018-06-14 07:10:37 +02:00
|
|
|
logd
|
|
|
|
userdebug_or_eng(`-logd')
|
|
|
|
ueventd
|
|
|
|
vendor_init
|
|
|
|
vold
|
2019-02-05 22:39:02 +01:00
|
|
|
userdebug_or_eng(`-vold')
|
2023-02-02 15:24:45 +01:00
|
|
|
}:process { ptrace signal sigstop sigkill };
|
2018-09-03 18:27:54 +02:00
|
|
|
|
|
|
|
neverallow crash_dump self:process ptrace;
|
2019-02-15 19:29:38 +01:00
|
|
|
neverallow crash_dump gpu_device:chr_file *;
|