Yabin Cui | e5fc21c | 2019-01-10 15:34:08 -0800 | [diff] [blame] | 1 | typeattribute simpleperf_app_runner coredomain; |
| 2 | |
| 3 | domain_auto_trans(shell, simpleperf_app_runner_exec, simpleperf_app_runner) |
Yabin Cui | 41a18f5 | 2021-06-30 11:54:41 -0700 | [diff] [blame] | 4 | |
| 5 | # run simpleperf_app_runner in adb shell. |
| 6 | allow simpleperf_app_runner adbd:fd use; |
| 7 | allow simpleperf_app_runner shell:fd use; |
| 8 | allow simpleperf_app_runner devpts:chr_file { read write ioctl }; |
| 9 | |
| 10 | # simpleperf_app_runner reads package information. |
| 11 | allow simpleperf_app_runner system_data_file:file r_file_perms; |
| 12 | allow simpleperf_app_runner system_data_file:lnk_file getattr; |
| 13 | allow simpleperf_app_runner packages_list_file:file r_file_perms; |
| 14 | |
| 15 | # The app's data dir may be accessed through a symlink. |
| 16 | allow simpleperf_app_runner system_data_file:lnk_file read; |
| 17 | |
| 18 | # simpleperf_app_runner switches to the app UID/GID. |
| 19 | allow simpleperf_app_runner self:global_capability_class_set { setuid setgid }; |
| 20 | |
| 21 | # simpleperf_app_runner switches to the app security context. |
| 22 | selinux_check_context(simpleperf_app_runner) # validate context |
| 23 | allow simpleperf_app_runner self:process setcurrent; |
Yabin Cui | dd2079d | 2021-09-07 17:10:21 +0000 | [diff] [blame] | 24 | allow simpleperf_app_runner untrusted_app_all:process dyntransition; # setcon |
Yabin Cui | 41a18f5 | 2021-06-30 11:54:41 -0700 | [diff] [blame] | 25 | |
| 26 | # simpleperf_app_runner/libselinux needs access to seapp_contexts_file to |
| 27 | # determine which domain to transition to. |
| 28 | allow simpleperf_app_runner seapp_contexts_file:file r_file_perms; |
| 29 | |
| 30 | # simpleperf_app_runner passes pipe fds. |
| 31 | # simpleperf_app_runner writes app type (debuggable or profileable) to pipe fds. |
| 32 | allow simpleperf_app_runner shell:fifo_file { read write }; |
| 33 | |
| 34 | # simpleperf_app_runner checks shell data paths. |
| 35 | # simpleperf_app_runner passes shell data fds. |
| 36 | allow simpleperf_app_runner shell_data_file:dir { getattr search }; |
| 37 | allow simpleperf_app_runner shell_data_file:file { getattr write }; |
| 38 | |
| 39 | ### |
| 40 | ### neverallow rules |
| 41 | ### |
| 42 | |
| 43 | # simpleperf_app_runner cannot have capabilities other than CAP_SETUID and CAP_SETGID |
| 44 | neverallow simpleperf_app_runner self:global_capability_class_set ~{ setuid setgid }; |
| 45 | neverallow simpleperf_app_runner self:global_capability2_class_set *; |