Yabin Cui | ffa2b61 | 2018-11-02 14:34:06 -0700 | [diff] [blame] | 1 | typeattribute runas_app coredomain; |
| 2 | |
| 3 | app_domain(runas_app) |
| 4 | untrusted_app_domain(runas_app) |
| 5 | net_domain(runas_app) |
| 6 | bluetooth_domain(runas_app) |
| 7 | |
Nick Kralevich | 65a89c1 | 2018-12-21 10:03:50 -0800 | [diff] [blame] | 8 | # The ability to call exec() on files in the apps home directories |
Yabin Cui | 770a4f6 | 2019-01-07 16:37:24 -0800 | [diff] [blame] | 9 | # when using run-as on a debuggable app. Used to run lldb/ndk-gdb/simpleperf, |
| 10 | # which are copied to the apps home directories. |
Nick Kralevich | 65a89c1 | 2018-12-21 10:03:50 -0800 | [diff] [blame] | 11 | allow runas_app app_data_file:file execute_no_trans; |
Yabin Cui | 770a4f6 | 2019-01-07 16:37:24 -0800 | [diff] [blame] | 12 | |
| 13 | # Allow lldb/ndk-gdb/simpleperf to read maps of debuggable app processes. |
| 14 | r_dir_file(runas_app, untrusted_app_all) |
| 15 | |
| 16 | # Allow lldb/ndk-gdb/simpleperf to ptrace attach to debuggable app processes. |
Jeff Vander Stoep | 5a6c0a7 | 2023-01-20 09:02:19 +0100 | [diff] [blame] | 17 | allow runas_app untrusted_app_all:process { ptrace sigkill signal sigstop }; |
Nick Kralevich | bafea95 | 2019-02-08 11:30:13 -0800 | [diff] [blame] | 18 | allow runas_app untrusted_app_all:unix_stream_socket connectto; |
Ryan Savitski | ffa0dd9 | 2020-01-10 19:02:43 +0000 | [diff] [blame] | 19 | |
| 20 | # Allow executing system image simpleperf without a domain transition. |
| 21 | allow runas_app simpleperf_exec:file rx_file_perms; |
| 22 | |
| 23 | # Suppress denial logspam when simpleperf is trying to find a matching process |
| 24 | # by scanning /proc/<pid>/cmdline files. The /proc/<pid> directories are within |
| 25 | # the same domain as their respective process, most of which this domain is not |
| 26 | # allowed to see. |
| 27 | dontaudit runas_app domain:dir search; |
| 28 | |
| 29 | # Allow runas_app to call perf_event_open for profiling debuggable app |
| 30 | # processes, but not the whole system. |
| 31 | allow runas_app self:perf_event { open read write kernel }; |
| 32 | neverallow runas_app self:perf_event ~{ open read write kernel }; |