blob: 40a5489eae49780904046d6fbb4794357ec9ea8d [file] [log] [blame]
Steven Moreland7baf7252018-05-25 16:23:37 -07001type mediacodec, domain, mlstrustedsubject;
2type mediacodec_exec, exec_type, vendor_file_type, file_type;
3
4init_daemon_domain(mediacodec)
5
6not_full_treble(`
7 # on legacy devices, continue to allow /dev/binder traffic
8 binder_use(mediacodec)
9 binder_service(mediacodec)
10 add_service(mediacodec, mediacodec_service)
11 allow mediacodec mediametrics_service:service_manager find;
12 allow mediacodec surfaceflinger_service:service_manager find;
13')
14
Chong Zhangbdbfff12018-09-20 12:07:44 -070015# can route /dev/binder traffic to /dev/vndbinder
16vndbinder_use(mediacodec)
17
Pawin Vongmasa609c2432019-04-30 05:09:28 -070018hal_server_domain(mediacodec, hal_codec2)
Steven Moreland7baf7252018-05-25 16:23:37 -070019hal_server_domain(mediacodec, hal_omx)
20
Pawin Vongmasa609c2432019-04-30 05:09:28 -070021# mediacodec may use an input surface from a different Codec2 or OMX service
22hal_client_domain(mediacodec, hal_codec2)
23hal_client_domain(mediacodec, hal_omx)
24
Steven Moreland7baf7252018-05-25 16:23:37 -070025hal_client_domain(mediacodec, hal_allocator)
Steven Moreland7baf7252018-05-25 16:23:37 -070026hal_client_domain(mediacodec, hal_graphics_allocator)
Chong Zhangbdbfff12018-09-20 12:07:44 -070027
28allow mediacodec gpu_device:chr_file rw_file_perms;
Pawin Vongmasa609c2432019-04-30 05:09:28 -070029allow mediacodec ion_device:chr_file rw_file_perms;
Chong Zhangbdbfff12018-09-20 12:07:44 -070030allow mediacodec video_device:chr_file rw_file_perms;
31allow mediacodec video_device:dir search;
32
Pawin Vongmasa609c2432019-04-30 05:09:28 -070033crash_dump_fallback(mediacodec)
34
35# mediacodec should never execute any executable without a domain transition
36neverallow mediacodec { file_type fs_type }:file execute_no_trans;
37
38# Media processing code is inherently risky and thus should have limited
39# permissions and be isolated from the rest of the system and network.
40# Lengthier explanation here:
41# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
42neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *;
43