ynwang | 9fa8823 | 2016-06-17 15:05:10 -0700 | [diff] [blame] | 1 | # storaged daemon |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 2 | type storaged, domain, coredomain, mlstrustedsubject; |
Nick Kralevich | 5e37271 | 2018-09-27 10:21:37 -0700 | [diff] [blame] | 3 | type storaged_exec, system_file_type, exec_type, file_type; |
ynwang | 9fa8823 | 2016-06-17 15:05:10 -0700 | [diff] [blame] | 4 | |
| 5 | init_daemon_domain(storaged) |
| 6 | |
ynwang | 9fa8823 | 2016-06-17 15:05:10 -0700 | [diff] [blame] | 7 | # Read access to pseudo filesystems |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 8 | r_dir_file(storaged, domain) |
ynwang | 9fa8823 | 2016-06-17 15:05:10 -0700 | [diff] [blame] | 9 | |
Jin Qian | d345906 | 2017-01-11 16:20:49 -0800 | [diff] [blame] | 10 | # Read /proc/uid_io/stats |
| 11 | allow storaged proc_uid_io_stats:file r_file_perms; |
| 12 | |
Jin Qian | 8ad57ef | 2017-01-20 20:29:13 -0800 | [diff] [blame] | 13 | # Read /data/system/packages.list |
| 14 | allow storaged system_data_file:file r_file_perms; |
Florian Mayer | 4ab64c9 | 2019-03-19 18:14:38 +0000 | [diff] [blame] | 15 | allow storaged packages_list_file:file r_file_perms; |
Jin Qian | 8ad57ef | 2017-01-20 20:29:13 -0800 | [diff] [blame] | 16 | |
Jin Qian | 4b6e673 | 2017-08-14 17:01:25 -0700 | [diff] [blame] | 17 | # Store storaged proto file |
| 18 | allow storaged storaged_data_file:dir rw_dir_perms; |
| 19 | allow storaged storaged_data_file:file create_file_perms; |
| 20 | |
Hridya Valsaraju | 23f9f51 | 2021-05-04 22:01:51 -0700 | [diff] [blame] | 21 | no_debugfs_restriction(` |
| 22 | userdebug_or_eng(` |
| 23 | # Read access to debugfs |
| 24 | allow storaged debugfs_mmc:dir search; |
| 25 | allow storaged debugfs_mmc:file r_file_perms; |
| 26 | ') |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 27 | ') |
ynwang | 9fa8823 | 2016-06-17 15:05:10 -0700 | [diff] [blame] | 28 | |
Jin Qian | a239f30 | 2017-03-23 12:28:20 -0700 | [diff] [blame] | 29 | # Needed to provide debug dump output via dumpsys pipes. |
| 30 | allow storaged shell:fd use; |
| 31 | allow storaged shell:fifo_file write; |
| 32 | |
Jin Qian | 00a1789 | 2017-04-12 17:38:11 -0700 | [diff] [blame] | 33 | # Needed for GMScore to call dumpsys storaged |
| 34 | allow storaged priv_app:fd use; |
Ashwini Oruganti | 7493bb5 | 2019-12-11 12:49:04 -0800 | [diff] [blame] | 35 | # b/142672293: No other priv-app should need this allow rule now that GMS core runs in its own domain. |
| 36 | # Remove after no logs are seen for this rule. |
| 37 | userdebug_or_eng(` |
| 38 | auditallow storaged priv_app:fd use; |
| 39 | ') |
| 40 | allow storaged gmscore_app:fd use; |
Nick Kralevich | 23c9d91 | 2018-08-02 15:54:23 -0700 | [diff] [blame] | 41 | allow storaged { privapp_data_file app_data_file }:file write; |
Jin Qian | 00a1789 | 2017-04-12 17:38:11 -0700 | [diff] [blame] | 42 | allow storaged permission_service:service_manager find; |
| 43 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 44 | # Binder permissions |
William Roberts | 606d2fd | 2017-01-19 13:23:52 -0800 | [diff] [blame] | 45 | add_service(storaged, storaged_service) |
Jin Qian | d345906 | 2017-01-11 16:20:49 -0800 | [diff] [blame] | 46 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 47 | binder_use(storaged) |
| 48 | binder_call(storaged, system_server) |
| 49 | |
Yifan Hong | b9aa010 | 2017-09-25 19:40:59 -0700 | [diff] [blame] | 50 | hal_client_domain(storaged, hal_health) |
Jin Qian | 61670b8 | 2017-02-06 11:04:31 -0800 | [diff] [blame] | 51 | |
William Roberts | fd8f305 | 2017-05-03 10:26:40 -0700 | [diff] [blame] | 52 | # Implements a dumpsys interface. |
| 53 | allow storaged dumpstate:fd use; |
| 54 | |
Todd Kennedy | 8bb8047 | 2017-08-02 07:27:44 -0700 | [diff] [blame] | 55 | # use a subset of the package manager service |
| 56 | allow storaged package_native_service:service_manager find; |
| 57 | |
Jin Qian | d3a1161 | 2017-02-22 17:27:57 -0800 | [diff] [blame] | 58 | # Kernel does extra check on CAP_DAC_OVERRIDE for libbinder when storaged is |
| 59 | # running as root. See b/35323867 #3. |
Benjamin Gordon | 342362a | 2018-09-06 16:19:40 -0600 | [diff] [blame] | 60 | dontaudit storaged self:global_capability_class_set { dac_override dac_read_search }; |
Jin Qian | d3a1161 | 2017-02-22 17:27:57 -0800 | [diff] [blame] | 61 | |
Joel Galenson | ba0c279 | 2018-03-02 14:14:44 -0800 | [diff] [blame] | 62 | # For collecting bugreports. |
| 63 | allow storaged dumpstate:fifo_file write; |
| 64 | |
ynwang | e68d2d2 | 2016-07-01 12:18:54 -0700 | [diff] [blame] | 65 | ### |
| 66 | ### neverallow |
| 67 | ### |
| 68 | neverallow storaged domain:process ptrace; |
Jin Qian | d3a1161 | 2017-02-22 17:27:57 -0800 | [diff] [blame] | 69 | neverallow storaged self:capability_class_set *; |