Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 1 | typeattribute bootstat coredomain; |
| 2 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 3 | init_daemon_domain(bootstat) |
Inseob Kim | 55e5c9b | 2020-03-04 17:20:35 +0900 | [diff] [blame] | 4 | |
| 5 | # Collect metrics on boot time created by init |
| 6 | get_prop(bootstat, boottime_prop) |
| 7 | |
| 8 | # Read/Write [persist.]sys.boot.reason and ro.boot.bootreason (write if empty) |
| 9 | set_prop(bootstat, bootloader_boot_reason_prop) |
| 10 | set_prop(bootstat, system_boot_reason_prop) |
| 11 | set_prop(bootstat, last_boot_reason_prop) |
| 12 | |
Inseob Kim | 75806ef | 2024-03-27 17:18:41 +0900 | [diff] [blame^] | 13 | read_runtime_log_tags(bootstat) |
| 14 | |
| 15 | # Allow persistent storage in /data/misc/bootstat. |
| 16 | allow bootstat bootstat_data_file:dir rw_dir_perms; |
| 17 | allow bootstat bootstat_data_file:file create_file_perms; |
| 18 | |
| 19 | allow bootstat metadata_file:dir search; |
| 20 | allow bootstat metadata_bootstat_file:dir rw_dir_perms; |
| 21 | allow 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 |
| 26 | allow bootstat pstorefs:dir search; |
| 27 | allow bootstat pstorefs:file r_file_perms; |
| 28 | allow bootstat kernel:system syslog_read; |
| 29 | |
| 30 | # Allow access to reading the logs to read aspects of system health |
| 31 | read_logd(bootstat) |
| 32 | |
| 33 | # Allow bootstat write to statsd. |
| 34 | unix_socket_send(bootstat, statsdw, statsd) |
| 35 | |
| 36 | ### |
| 37 | ### Neverallow rules |
| 38 | ### |
| 39 | |
| 40 | neverallow { |
| 41 | domain |
| 42 | -bootstat |
| 43 | -init |
| 44 | } system_boot_reason_prop:property_service set; |
| 45 | |
Inseob Kim | 55e5c9b | 2020-03-04 17:20:35 +0900 | [diff] [blame] | 46 | neverallow { |
| 47 | domain |
| 48 | -bootanim |
| 49 | -bootstat |
| 50 | -dumpstate |
Wenjie Zhou | 27d5255 | 2020-04-09 14:43:00 -0700 | [diff] [blame] | 51 | userdebug_or_eng(`-incidentd') |
Inseob Kim | 55e5c9b | 2020-03-04 17:20:35 +0900 | [diff] [blame] | 52 | -init |
Alexei Nicoara | 957e8f3 | 2023-09-11 17:43:45 +0100 | [diff] [blame] | 53 | -platform_app |
Inseob Kim | 55e5c9b | 2020-03-04 17:20:35 +0900 | [diff] [blame] | 54 | -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 |
| 59 | neverallow { bootanim recovery } last_boot_reason_prop:file r_file_perms; |
| 60 | |
| 61 | neverallow { |
| 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_ |
| 68 | neverallow system_server bootloader_boot_reason_prop:property_service set; |