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; |
| 25 | |
| 26 | allow mediatranscoding system_server:fd use; |
| 27 | allow mediatranscoding activity_service:service_manager find; |
| 28 | |
| 29 | # allow mediatranscoding service read/write permissions for file sources |
| 30 | allow mediatranscoding sdcardfs:file { getattr read write }; |
| 31 | allow mediatranscoding media_rw_data_file:file { getattr read write }; |
| 32 | allow mediatranscoding apk_data_file:file { getattr read }; |
| 33 | allow mediatranscoding shell_data_file:file { getattr read write }; |
| 34 | |
| 35 | # mediatranscoding should never execute any executable without a |
| 36 | # domain transition |
| 37 | neverallow mediatranscoding { file_type fs_type }:file execute_no_trans; |
| 38 | |
| 39 | # The goal of the mediaserver split is to place media processing code into |
| 40 | # restrictive sandboxes with limited responsibilities and thus limited |
| 41 | # permissions. Example: Audioserver is only responsible for controlling audio |
| 42 | # hardware and processing audio content. Cameraserver does the same for camera |
| 43 | # hardware/content. Etc. |
| 44 | # |
| 45 | # Media processing code is inherently risky and thus should have limited |
| 46 | # permissions and be isolated from the rest of the system and network. |
| 47 | # Lengthier explanation here: |
| 48 | # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html |
| 49 | neverallow mediatranscoding domain:{ tcp_socket udp_socket rawip_socket } *; |