0fee0133c6
mediacodec currently only has permissions to allocate from ION heaps. The following permission is required for it to allocate from the DMA-BUF system heap via the the codec2 allocator. It resolves the following denial in the sdk_gphone_x86_64-userdebug target: 01-08 22:43:48.712 337 337 I auditd : type=1400 audit(0.0:6): avc: denied { getattr } for comm="android.hardwar" path="/dev/dma_heap/system-uncached" dev="tmpfs" ino=311 scontext=u:r:mediacodec:s0 tcontext=u:object_r:dmabuf_system_heap_device:s0 tclass=chr_file permissive=0 Bug: 170887642 Test: make and boot Change-Id: I5503ed6ffa47a84f614792de866ddafbec0cdcda
38 lines
1.4 KiB
Text
38 lines
1.4 KiB
Text
type mediacodec, domain, mlstrustedsubject;
|
|
type mediacodec_exec, exec_type, vendor_file_type, file_type;
|
|
|
|
init_daemon_domain(mediacodec)
|
|
|
|
# can route /dev/binder traffic to /dev/vndbinder
|
|
vndbinder_use(mediacodec)
|
|
|
|
hal_server_domain(mediacodec, hal_codec2)
|
|
hal_server_domain(mediacodec, hal_omx)
|
|
|
|
# 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)
|
|
|
|
hal_client_domain(mediacodec, hal_allocator)
|
|
hal_client_domain(mediacodec, hal_graphics_allocator)
|
|
|
|
allow mediacodec gpu_device:chr_file rw_file_perms;
|
|
allow mediacodec ion_device:chr_file rw_file_perms;
|
|
allow mediacodec dmabuf_system_heap_device:chr_file r_file_perms;
|
|
allow mediacodec video_device:chr_file rw_file_perms;
|
|
allow mediacodec video_device:dir search;
|
|
|
|
crash_dump_fallback(mediacodec)
|
|
|
|
# get aac_drc_* properties
|
|
get_prop(mediacodec, aac_drc_prop)
|
|
|
|
# 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
|
|
neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *;
|
|
|