Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 1 | typeattribute runas coredomain; |
| 2 | |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 3 | # ndk-gdb invokes adb shell run-as. |
| 4 | domain_auto_trans(shell, runas_exec, runas) |
Inseob Kim | 75806ef | 2024-03-27 17:18:41 +0900 | [diff] [blame] | 5 | |
| 6 | allow runas adbd:fd use; |
| 7 | allow runas adbd:process sigchld; |
| 8 | allow runas adbd:unix_stream_socket { read write }; |
| 9 | allow runas shell:fd use; |
| 10 | allow runas shell:fifo_file { read write }; |
| 11 | allow runas shell:unix_stream_socket { read write }; |
| 12 | allow runas devpts:chr_file { read write ioctl }; |
| 13 | allow runas shell_data_file:file { read write }; |
| 14 | |
| 15 | # run-as reads package information. |
| 16 | allow runas system_data_file:file r_file_perms; |
| 17 | allow runas system_data_file:lnk_file getattr; |
| 18 | allow runas packages_list_file:file r_file_perms; |
| 19 | |
| 20 | # The app's data dir may be accessed through a symlink. |
| 21 | allow runas system_data_file:lnk_file read; |
| 22 | |
| 23 | # run-as checks and changes to the app data dir. |
| 24 | dontaudit runas self:global_capability_class_set { dac_override dac_read_search }; |
| 25 | allow runas app_data_file:dir { getattr search }; |
| 26 | |
| 27 | # run-as switches to the app UID/GID. |
| 28 | allow runas self:global_capability_class_set { setuid setgid }; |
| 29 | |
| 30 | # run-as switches to the app security context. |
| 31 | selinux_check_context(runas) # validate context |
| 32 | allow runas self:process setcurrent; |
| 33 | allow runas non_system_app_set:process dyntransition; # setcon |
| 34 | |
| 35 | # runas/libselinux needs access to seapp_contexts_file to |
| 36 | # determine which domain to transition to. |
| 37 | allow runas seapp_contexts_file:file r_file_perms; |
| 38 | |
| 39 | ### |
| 40 | ### neverallow rules |
| 41 | ### |
| 42 | |
| 43 | # run-as cannot have capabilities other than CAP_SETUID and CAP_SETGID |
| 44 | neverallow runas self:global_capability_class_set ~{ setuid setgid }; |
| 45 | neverallow runas self:global_capability2_class_set *; |