device_google_zuma/vendor/mediacodec_samsung.te
Ernie Hsu bb7586ac03 mediacodec_samsung: add sepolicy for mfc codec
Add necessary sepolicy. Log and reason are added in review comment
move sysfs out from legacy setting

Bug: 262633502
Bug: 263049105
Bug: 262794577
Bug: 262794578
Bug: 262794634
Test: video playback
      SELinuxTest#scanBugreport
      SELinuxTest#scanAvcDeniedLogRightAfterReboot
Change-Id: I240f3fc4672a0d3133699f76a808573e172d23f2
2022-12-22 03:46:04 +00:00

37 lines
1.5 KiB
Text

type mediacodec_samsung, domain;
type mediacodec_samsung_exec, vendor_file_type, exec_type, file_type;
init_daemon_domain(mediacodec_samsung)
hal_server_domain(mediacodec_samsung, hal_codec2)
add_service(mediacodec_samsung, eco_service)
vndbinder_use(mediacodec_samsung)
allow mediacodec_samsung video_device:chr_file rw_file_perms;
allow mediacodec_samsung dmabuf_system_heap_device:chr_file r_file_perms;
allow mediacodec_samsung gpu_device:chr_file rw_file_perms;
allow mediacodec_samsung sysfs_mfc:file r_file_perms;
allow mediacodec_samsung sysfs_mfc:dir r_dir_perms;
# can use graphics allocator
hal_client_domain(mediacodec_samsung, hal_graphics_allocator)
binder_call(mediacodec_samsung, hal_camera_default)
crash_dump_fallback(mediacodec_samsung)
# mediacodec_samsung should never execute any executable without a domain transition
neverallow mediacodec_samsung { 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_samsung domain:{ udp_socket rawip_socket } *;
neverallow mediacodec_samsung { domain userdebug_or_eng(`-su') }:tcp_socket *;
userdebug_or_eng(`
allow mediacodec_samsung vendor_media_data_file:dir rw_dir_perms;
allow mediacodec_samsung vendor_media_data_file:file create_file_perms;
')