Chong Zhang | 351dd88 | 2020-06-10 12:10:16 -0700 | [diff] [blame] | 1 | # mediatranscoding - daemon for transcoding video and image. |
| 2 | type mediatranscoding_exec, system_file_type, exec_type, file_type; |
| 3 | type mediatranscoding_tmpfs, file_type; |
Hangyu Kuang | ee3a8ea | 2019-11-27 18:10:01 -0800 | [diff] [blame] | 4 | typeattribute mediatranscoding coredomain; |
| 5 | |
| 6 | init_daemon_domain(mediatranscoding) |
Chong Zhang | 351dd88 | 2020-06-10 12:10:16 -0700 | [diff] [blame] | 7 | tmpfs_domain(mediatranscoding) |
| 8 | allow mediatranscoding appdomain_tmpfs:file { getattr map read write }; |
| 9 | |
| 10 | binder_use(mediatranscoding) |
| 11 | binder_call(mediatranscoding, binderservicedomain) |
| 12 | binder_call(mediatranscoding, appdomain) |
| 13 | binder_service(mediatranscoding) |
| 14 | |
| 15 | add_service(mediatranscoding, mediatranscoding_service) |
| 16 | |
| 17 | hal_client_domain(mediatranscoding, hal_graphics_allocator) |
| 18 | hal_client_domain(mediatranscoding, hal_configstore) |
| 19 | hal_client_domain(mediatranscoding, hal_omx) |
| 20 | hal_client_domain(mediatranscoding, hal_codec2) |
| 21 | |
| 22 | allow mediatranscoding mediaserver_service:service_manager find; |
| 23 | allow mediatranscoding mediametrics_service:service_manager find; |
| 24 | allow mediatranscoding mediaextractor_service:service_manager find; |
Chong Zhang | ce3c1f3 | 2020-10-05 12:08:51 -0700 | [diff] [blame] | 25 | allow mediatranscoding package_native_service:service_manager find; |
Chong Zhang | 19c275f | 2021-01-19 16:17:27 -0800 | [diff] [blame] | 26 | allow mediatranscoding thermal_service:service_manager find; |
Chong Zhang | 351dd88 | 2020-06-10 12:10:16 -0700 | [diff] [blame] | 27 | |
| 28 | allow mediatranscoding system_server:fd use; |
| 29 | allow mediatranscoding activity_service:service_manager find; |
| 30 | |
| 31 | # allow mediatranscoding service read/write permissions for file sources |
| 32 | allow mediatranscoding sdcardfs:file { getattr read write }; |
| 33 | allow mediatranscoding media_rw_data_file:file { getattr read write }; |
| 34 | allow mediatranscoding apk_data_file:file { getattr read }; |
hkuang | 9e92b1b | 2020-06-18 17:25:42 -0700 | [diff] [blame] | 35 | allow mediatranscoding app_data_file:file { getattr read write }; |
Chong Zhang | 351dd88 | 2020-06-10 12:10:16 -0700 | [diff] [blame] | 36 | allow mediatranscoding shell_data_file:file { getattr read write }; |
| 37 | |
Linus Nilsson | ba1ba35 | 2021-02-26 16:32:22 -0800 | [diff] [blame] | 38 | # allow mediatranscoding service write permission to statsd socket |
| 39 | unix_socket_send(mediatranscoding, statsdw, statsd) |
| 40 | |
Hridya Valsaraju | 15f0f92 | 2021-04-27 17:34:41 -0700 | [diff] [blame] | 41 | # Allow mediatranscoding to access the DMA-BUF system heap |
| 42 | allow mediatranscoding dmabuf_system_heap_device:chr_file r_file_perms; |
| 43 | |
Hridya Valsaraju | a2a2d9c | 2021-04-29 12:49:30 -0700 | [diff] [blame] | 44 | allow mediatranscoding gpu_device:dir search; |
| 45 | |
| 46 | # Allow mediatranscoding service to access media-related system properties |
| 47 | get_prop(mediatranscoding, media_config_prop) |
| 48 | |
Chong Zhang | 351dd88 | 2020-06-10 12:10:16 -0700 | [diff] [blame] | 49 | # mediatranscoding should never execute any executable without a |
| 50 | # domain transition |
| 51 | neverallow mediatranscoding { file_type fs_type }:file execute_no_trans; |
| 52 | |
| 53 | # The goal of the mediaserver split is to place media processing code into |
| 54 | # restrictive sandboxes with limited responsibilities and thus limited |
| 55 | # permissions. Example: Audioserver is only responsible for controlling audio |
| 56 | # hardware and processing audio content. Cameraserver does the same for camera |
| 57 | # hardware/content. Etc. |
| 58 | # |
| 59 | # Media processing code is inherently risky and thus should have limited |
| 60 | # permissions and be isolated from the rest of the system and network. |
| 61 | # Lengthier explanation here: |
| 62 | # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html |
Yifan Hong | be04b09 | 2021-06-07 12:37:31 -0700 | [diff] [blame] | 63 | neverallow mediatranscoding domain:{ udp_socket rawip_socket } *; |
| 64 | neverallow mediatranscoding { domain userdebug_or_eng(`-su') }:tcp_socket *; |