2018-05-26 01:23:37 +02:00
|
|
|
type mediacodec, domain, mlstrustedsubject;
|
|
|
|
type mediacodec_exec, exec_type, vendor_file_type, file_type;
|
|
|
|
|
|
|
|
init_daemon_domain(mediacodec)
|
|
|
|
|
2018-09-20 21:07:44 +02:00
|
|
|
# can route /dev/binder traffic to /dev/vndbinder
|
|
|
|
vndbinder_use(mediacodec)
|
|
|
|
|
2019-04-30 14:09:28 +02:00
|
|
|
hal_server_domain(mediacodec, hal_codec2)
|
2018-05-26 01:23:37 +02:00
|
|
|
hal_server_domain(mediacodec, hal_omx)
|
|
|
|
|
2019-04-30 14:09:28 +02:00
|
|
|
# mediacodec may use an input surface from a different Codec2 or OMX service
|
|
|
|
hal_client_domain(mediacodec, hal_codec2)
|
|
|
|
hal_client_domain(mediacodec, hal_omx)
|
|
|
|
|
2018-05-26 01:23:37 +02:00
|
|
|
hal_client_domain(mediacodec, hal_allocator)
|
|
|
|
hal_client_domain(mediacodec, hal_graphics_allocator)
|
2018-09-20 21:07:44 +02:00
|
|
|
|
|
|
|
allow mediacodec gpu_device:chr_file rw_file_perms;
|
2022-02-24 19:32:16 +01:00
|
|
|
allow mediacodec gpu_device:dir r_dir_perms;
|
2019-04-30 14:09:28 +02:00
|
|
|
allow mediacodec ion_device:chr_file rw_file_perms;
|
2021-01-14 06:05:07 +01:00
|
|
|
allow mediacodec dmabuf_system_heap_device:chr_file r_file_perms;
|
2018-09-20 21:07:44 +02:00
|
|
|
allow mediacodec video_device:chr_file rw_file_perms;
|
|
|
|
allow mediacodec video_device:dir search;
|
|
|
|
|
2019-04-30 14:09:28 +02:00
|
|
|
crash_dump_fallback(mediacodec)
|
|
|
|
|
2020-05-06 11:30:20 +02:00
|
|
|
# get aac_drc_* properties
|
|
|
|
get_prop(mediacodec, aac_drc_prop)
|
|
|
|
|
2019-04-30 14:09:28 +02:00
|
|
|
# mediacodec should never execute any executable without a domain transition
|
|
|
|
neverallow mediacodec { file_type fs_type }:file execute_no_trans;
|
|
|
|
|
|
|
|
# Media processing code is inherently risky and thus should have limited
|
|
|
|
# permissions and be isolated from the rest of the system and network.
|
|
|
|
# Lengthier explanation here:
|
|
|
|
# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
|
2021-06-07 21:37:31 +02:00
|
|
|
neverallow mediacodec domain:{ udp_socket rawip_socket } *;
|
|
|
|
neverallow mediacodec { domain userdebug_or_eng(`-su') }:tcp_socket *;
|
2019-04-30 14:09:28 +02:00
|
|
|
|