Ernie Hsu | 3b4a36a | 2024-07-17 10:04:25 +0000 | [diff] [blame] | 1 | type mediacodec_google, domain; |
| 2 | type mediacodec_google_exec, exec_type, vendor_file_type, file_type; |
| 3 | |
| 4 | init_daemon_domain(mediacodec_google) |
| 5 | |
Ernie Hsu | bbe999c | 2024-07-18 10:41:41 +0000 | [diff] [blame] | 6 | hal_server_domain(mediacodec_google, hal_codec2) |
| 7 | |
| 8 | hal_client_domain(mediacodec_google, hal_graphics_allocator) |
| 9 | |
Ernie Hsu | 13883d9 | 2024-08-27 04:11:51 +0000 | [diff] [blame^] | 10 | add_service(mediacodec_google, eco_service) |
| 11 | |
Ernie Hsu | bbe999c | 2024-07-18 10:41:41 +0000 | [diff] [blame] | 12 | allow mediacodec_google dmabuf_system_heap_device:chr_file r_file_perms; |
Ernie Hsu | a01bc1d | 2024-08-27 03:32:27 +0000 | [diff] [blame] | 13 | allow mediacodec_google video_device:chr_file { read write open ioctl map }; |
Ernie Hsu | bbe999c | 2024-07-18 10:41:41 +0000 | [diff] [blame] | 14 | |
| 15 | # mediacodec_google should never execute any executable without a domain transition |
| 16 | neverallow mediacodec_google { file_type fs_type }:file execute_no_trans; |
| 17 | |
| 18 | # Media processing code is inherently risky and thus should have limited |
| 19 | # permissions and be isolated from the rest of the system and network. |
| 20 | # Lengthier explanation here: |
| 21 | # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html |
| 22 | neverallow mediacodec_google domain:{ udp_socket rawip_socket } *; |
| 23 | neverallow mediacodec_google { domain userdebug_or_eng(`-su') }:tcp_socket *; |
Ernie Hsu | 13883d9 | 2024-08-27 04:11:51 +0000 | [diff] [blame^] | 24 | |
| 25 | userdebug_or_eng(` |
| 26 | allow mediacodec_google vendor_media_data_file:dir rw_dir_perms; |
| 27 | allow mediacodec_google vendor_media_data_file:file create_file_perms; |
| 28 | ') |