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