device_google_gs-common/mediacodec/vpu/sepolicy/mediacodec_google.te
Wesley Lee 0649754278 mediacodec: add GPU access policy
avc:  denied  { read write }
for  comm="binder:757_6" name="renderD128" dev="tmpfs"
ino=1566 scontext=u:r:mediacodec_google:s0
tcontext=u:object_r:gpu_device:s0 tclass=chr_file permissive=1

Bug: 378609071

Flag: EXEMPT bugfix

Test: run cts -m CtsMediaV2TestCases -t
android.mediav2.cts.CodecEncoderSurfaceTest#testSimpleEncodeFromSurface[26_c2.google.av1.encoder_video/av01_c2.google.av1.decoder_video/av01_512kbps_30fps_yuv420flexible_tonemapyes_persistentsurface]

Change-Id: I2af4f53c9ff8aca0d3c7fd721738f2044d4772fd
Signed-off-by: Wesley Lee <szuweilee@google.com>
2024-11-20 06:29:09 +00:00

34 lines
1.4 KiB
Text

# Google Mediacodec
type mediacodec_google, domain;
type mediacodec_google_exec, exec_type, vendor_file_type, file_type;
init_daemon_domain(mediacodec_google)
hal_server_domain(mediacodec_google, hal_codec2)
hal_client_domain(mediacodec_google, hal_graphics_allocator)
add_service(mediacodec_google, eco_service)
binder_call(mediacodec_google, hal_camera_default)
allow mediacodec_google dmabuf_system_heap_device:chr_file r_file_perms;
allow mediacodec_google video_device:chr_file { read write open ioctl map };
allow mediacodec_google gpu_device:chr_file rw_file_perms;
# mediacodec_google should never execute any executable without a domain transition
neverallow mediacodec_google { 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_google domain:{ udp_socket rawip_socket } *;
neverallow mediacodec_google { domain userdebug_or_eng(`-su') }:tcp_socket *;
# Allow HAL to send trace packets to Perfetto
userdebug_or_eng(`perfetto_producer(mediacodec_google)')
userdebug_or_eng(`
allow mediacodec_google vendor_media_data_file:dir rw_dir_perms;
allow mediacodec_google vendor_media_data_file:file create_file_perms;
')