Inseob Kim | 43b6a31 | 2021-11-30 12:04:43 +0900 | [diff] [blame] | 1 | # Any files which would have been created as app_data_file and |
| 2 | # privapp_data_file will be created as app_exec_data_file instead. |
| 3 | allow rs { app_data_file privapp_data_file }:dir ra_dir_perms; |
| 4 | allow rs app_exec_data_file:file create_file_perms; |
| 5 | type_transition rs app_data_file:file app_exec_data_file; |
| 6 | type_transition rs privapp_data_file:file app_exec_data_file; |
| 7 | |
| 8 | # Follow /data/user/0 symlink |
| 9 | allow rs system_data_file:lnk_file read; |
| 10 | |
| 11 | # Read files from the app home directory. |
| 12 | allow rs { app_data_file privapp_data_file }:file r_file_perms; |
| 13 | allow rs { app_data_file privapp_data_file }:dir r_dir_perms; |
| 14 | |
| 15 | # Cleanup app_exec_data_file files in the app home directory. |
| 16 | allow rs { app_data_file privapp_data_file }:dir remove_name; |
| 17 | |
| 18 | # Use vendor resources |
| 19 | allow rs vendor_file:dir r_dir_perms; |
| 20 | r_dir_file(rs, vendor_overlay_file) |
| 21 | r_dir_file(rs, vendor_app_file) |
| 22 | |
| 23 | # Read contents of app apks |
| 24 | r_dir_file(rs, apk_data_file) |
| 25 | |
| 26 | allow rs gpu_device:chr_file rw_file_perms; |
| 27 | allow rs ion_device:chr_file r_file_perms; |
| 28 | allow rs same_process_hal_file:file { r_file_perms execute }; |
| 29 | |
| 30 | # File descriptors passed from app to renderscript |
| 31 | allow rs { untrusted_app_all ephemeral_app priv_app }:fd use; |
| 32 | |
| 33 | # rs can access app data, so ensure it can only be entered via an app domain and cannot have |
| 34 | # CAP_DAC_OVERRIDE. |
| 35 | neverallow rs rs:capability_class_set *; |
| 36 | neverallow { domain -appdomain } rs:process { dyntransition transition }; |
| 37 | neverallow rs { domain -crash_dump }:process { dyntransition transition }; |
| 38 | neverallow rs app_data_file:file_class_set ~r_file_perms; |
| 39 | # rs should never use network sockets |
| 40 | neverallow rs *:network_socket_class_set *; |