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