blob: ecbe2802cf02c418020fa4ef5605c7ff5dc9f145 [file] [log] [blame]
Marco Nelissenc3ba2e52016-02-02 16:10:37 -08001# mediacodec - audio and video codecs live here
2type mediacodec, domain;
3type mediacodec_exec, exec_type, file_type;
4
5typeattribute mediacodec mlstrustedsubject;
6
Steven Morelandd3ce5dc2017-03-22 09:16:49 -07007# TODO(b/36375899) attributize this domain appropriately as hal_omx
8# and use macro hal_server_domain
9get_prop(mediacodec, hwservicemanager_prop)
10
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080011binder_use(mediacodec)
12binder_call(mediacodec, binderservicedomain)
13binder_call(mediacodec, appdomain)
14binder_service(mediacodec)
15
Alex Klyubin44df5b92017-03-24 17:22:17 -070016# TODO(b/36604251): Remove this once OMX HAL stops using Binder
17typeattribute mediacodec binder_in_vendor_violators;
William Roberts606d2fd2017-01-19 13:23:52 -080018add_service(mediacodec, mediacodec_service)
Ray Essick39185402017-01-24 12:53:45 -080019allow mediacodec mediametrics_service:service_manager find;
Marco Nelissen6c53b232016-02-27 21:25:03 -080020allow mediacodec surfaceflinger_service:service_manager find;
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080021allow mediacodec gpu_device:chr_file rw_file_perms;
22allow mediacodec video_device:chr_file rw_file_perms;
Robb Glasserb7a76e92016-02-11 10:33:57 -080023allow mediacodec video_device:dir search;
Marco Nelissenebf79f82016-02-24 10:03:25 -080024allow mediacodec ion_device:chr_file rw_file_perms;
Chia-I Wudd958e52016-10-12 06:38:00 -070025allow mediacodec hal_graphics_allocator:fd use;
Yin-Chia Yeh6824dfd2017-02-24 17:45:11 -080026allow mediacodec hal_camera:fd use;
27
Josh Gao12b47502017-03-06 18:13:05 -080028crash_dump_fallback(mediacodec)
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080029
Alex Klyubin7cda44f2017-03-21 14:28:53 -070030hal_client_domain(mediacodec, hal_allocator)
Pawin Vongmasa5559d212017-01-24 02:45:16 -080031
Jiwen 'Steve' Caieeb0d382017-03-09 18:44:07 -080032# Recieve gralloc buffer FDs from bufferhubd. Note that mediacodec never
33# directly connects to bufferhubd via PDX. Instead, a VR app acts as a bridge
34# between those two: it talks to mediacodec via Binder and talks to bufferhubd
35# via PDX. Thus, there is no need to use use_pdx macro.
36allow mediacodec bufferhubd:fd use;
37
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080038###
39### neverallow rules
40###
41
42# mediacodec should never execute any executable without a
43# domain transition
44neverallow mediacodec { file_type fs_type }:file execute_no_trans;
45
Nick Kralevich38c12822017-02-16 12:34:51 -080046# The goal of the mediaserver split is to place media processing code into
47# restrictive sandboxes with limited responsibilities and thus limited
48# permissions. Example: Audioserver is only responsible for controlling audio
49# hardware and processing audio content. Cameraserver does the same for camera
50# hardware/content. Etc.
51#
52# Media processing code is inherently risky and thus should have limited
53# permissions and be isolated from the rest of the system and network.
54# Lengthier explanation here:
55# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
Jeff Vander Stoep21f77f62016-04-22 15:34:40 -070056neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *;