blob: 9835940188db3c93ac8d9ce15c229a90322dd7bc [file] [log] [blame]
Alex Klyubinf5446eb2017-03-23 14:27:32 -07001typeattribute bootstat coredomain;
2
dcashmancc39f632016-07-22 13:13:11 -07003init_daemon_domain(bootstat)
Inseob Kim55e5c9b2020-03-04 17:20:35 +09004
5# Collect metrics on boot time created by init
6get_prop(bootstat, boottime_prop)
7
8# Read/Write [persist.]sys.boot.reason and ro.boot.bootreason (write if empty)
9set_prop(bootstat, bootloader_boot_reason_prop)
10set_prop(bootstat, system_boot_reason_prop)
11set_prop(bootstat, last_boot_reason_prop)
12
Inseob Kim75806ef2024-03-27 17:18:41 +090013read_runtime_log_tags(bootstat)
14
15# Allow persistent storage in /data/misc/bootstat.
16allow bootstat bootstat_data_file:dir rw_dir_perms;
17allow bootstat bootstat_data_file:file create_file_perms;
18
19allow bootstat metadata_file:dir search;
20allow bootstat metadata_bootstat_file:dir rw_dir_perms;
21allow bootstat metadata_bootstat_file:file create_file_perms;
22
23# ToDo: TBI move access for the following to a system health HAL
24
25# Allow access to /sys/fs/pstore/ and syslog
26allow bootstat pstorefs:dir search;
27allow bootstat pstorefs:file r_file_perms;
28allow bootstat kernel:system syslog_read;
29
30# Allow access to reading the logs to read aspects of system health
31read_logd(bootstat)
32
33# Allow bootstat write to statsd.
34unix_socket_send(bootstat, statsdw, statsd)
35
36###
37### Neverallow rules
38###
39
40neverallow {
41 domain
42 -bootstat
43 -init
44} system_boot_reason_prop:property_service set;
45
Inseob Kim55e5c9b2020-03-04 17:20:35 +090046neverallow {
47 domain
48 -bootanim
49 -bootstat
50 -dumpstate
Wenjie Zhou27d52552020-04-09 14:43:00 -070051 userdebug_or_eng(`-incidentd')
Inseob Kim55e5c9b2020-03-04 17:20:35 +090052 -init
Alexei Nicoara957e8f32023-09-11 17:43:45 +010053 -platform_app
Inseob Kim55e5c9b2020-03-04 17:20:35 +090054 -recovery
55 -shell
56 -system_server
57} { bootloader_boot_reason_prop last_boot_reason_prop }:file r_file_perms;
58# ... and refine, as these components should not set the last boot reason
59neverallow { bootanim recovery } last_boot_reason_prop:file r_file_perms;
60
61neverallow {
62 domain
63 -bootstat
64 -init
65 -system_server
66} { bootloader_boot_reason_prop last_boot_reason_prop }:property_service set;
67# ... and refine ... for a ro propertly no less ... keep this _tight_
68neverallow system_server bootloader_boot_reason_prop:property_service set;