MediaTranscodingService: Add sepolicy for MediaTranscodingService.

Bug:145233472
Test: Build and flash the phone.
"adb shell dumpsys -l | grep media" shows media.transcoding service.

Change-Id: I48a42e7b595754989c92a8469eb91360ab6db7c6
This commit is contained in:
Hangyu Kuang 2019-11-27 18:10:01 -08:00
parent 584234e8b1
commit ee3a8ea798
7 changed files with 37 additions and 0 deletions

View file

@ -26,6 +26,10 @@
iorap_prefetcherd_data_file iorap_prefetcherd_data_file
iorap_prefetcherd_exec iorap_prefetcherd_exec
iorap_prefetcherd_tmpfs iorap_prefetcherd_tmpfs
mediatranscoding_service
mediatranscoding
mediatranscoding_exec
mediatranscoding_tmpfs
linker_prop linker_prop
mock_ota_prop mock_ota_prop
ota_metadata_file ota_metadata_file

View file

@ -239,6 +239,7 @@
/system/bin/cameraserver u:object_r:cameraserver_exec:s0 /system/bin/cameraserver u:object_r:cameraserver_exec:s0
/system/bin/mediaextractor u:object_r:mediaextractor_exec:s0 /system/bin/mediaextractor u:object_r:mediaextractor_exec:s0
/system/bin/mediaswcodec u:object_r:mediaswcodec_exec:s0 /system/bin/mediaswcodec u:object_r:mediaswcodec_exec:s0
/system/bin/mediatranscoding u:object_r:mediatranscoding_exec:s0
/system/bin/mdnsd u:object_r:mdnsd_exec:s0 /system/bin/mdnsd u:object_r:mdnsd_exec:s0
/system/bin/installd u:object_r:installd_exec:s0 /system/bin/installd u:object_r:installd_exec:s0
/system/bin/otapreopt_chroot u:object_r:otapreopt_chroot_exec:s0 /system/bin/otapreopt_chroot u:object_r:otapreopt_chroot_exec:s0

View file

@ -10,3 +10,4 @@ hal_client_domain(mediaserver, hal_drm)
hal_client_domain(mediaserver, hal_omx) hal_client_domain(mediaserver, hal_omx)
hal_client_domain(mediaserver, hal_codec2) hal_client_domain(mediaserver, hal_codec2)
allow mediaserver mediatranscoding_service:service_manager find;

View file

@ -0,0 +1,3 @@
typeattribute mediatranscoding coredomain;
init_daemon_domain(mediatranscoding)

View file

@ -118,6 +118,7 @@ media.log u:object_r:audioserver_service:s0
media.player u:object_r:mediaserver_service:s0 media.player u:object_r:mediaserver_service:s0
media.metrics u:object_r:mediametrics_service:s0 media.metrics u:object_r:mediametrics_service:s0
media.extractor u:object_r:mediaextractor_service:s0 media.extractor u:object_r:mediaextractor_service:s0
media.transcoding u:object_r:mediatranscoding_service:s0
media.resource_manager u:object_r:mediaserver_service:s0 media.resource_manager u:object_r:mediaserver_service:s0
media.sound_trigger_hw u:object_r:audioserver_service:s0 media.sound_trigger_hw u:object_r:audioserver_service:s0
media.drm u:object_r:mediadrmserver_service:s0 media.drm u:object_r:mediadrmserver_service:s0

View file

@ -0,0 +1,26 @@
# mediatranscoding - daemon for transcoding video and image.
type mediatranscoding, domain;
type mediatranscoding_exec, system_file_type, exec_type, file_type;
binder_use(mediatranscoding)
binder_service(mediatranscoding)
add_service(mediatranscoding, mediatranscoding_service)
allow mediatranscoding system_server:fd use;
# mediatranscoding should never execute any executable without a
# domain transition
neverallow mediatranscoding { file_type fs_type }:file execute_no_trans;
# The goal of the mediaserver split is to place media processing code into
# restrictive sandboxes with limited responsibilities and thus limited
# permissions. Example: Audioserver is only responsible for controlling audio
# hardware and processing audio content. Cameraserver does the same for camera
# hardware/content. Etc.
#
# 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 mediatranscoding domain:{ tcp_socket udp_socket rawip_socket } *;

View file

@ -21,6 +21,7 @@ type mediaserver_service, service_manager_type;
type mediametrics_service, service_manager_type; type mediametrics_service, service_manager_type;
type mediaextractor_service, service_manager_type; type mediaextractor_service, service_manager_type;
type mediadrmserver_service, service_manager_type; type mediadrmserver_service, service_manager_type;
type mediatranscoding_service, app_api_service, service_manager_type;
type netd_service, service_manager_type; type netd_service, service_manager_type;
type nfc_service, service_manager_type; type nfc_service, service_manager_type;
type radio_service, service_manager_type; type radio_service, service_manager_type;