blob: e5b4a7d352dd42a048bae2d2658330c9ef598147 [file] [log] [blame]
Marco Nelissenc3ba2e52016-02-02 16:10:37 -08001# mediacodec - audio and video codecs live here
2type mediacodec, domain;
Sandeep Patil2ee66e72017-04-10 13:03:28 -07003type mediacodec_exec, exec_type, vendor_file_type, file_type;
Marco Nelissenc3ba2e52016-02-02 16:10:37 -08004
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
Steven Morelandd64561f2017-05-02 08:57:45 -070011# can route /dev/binder traffic to /dev/vndbinder
12vndbinder_use(mediacodec)
13
Iliyan Malchev56cdcd42017-04-11 20:01:51 -070014not_full_treble(`
15 # on legacy devices, continue to allow /dev/binder traffic
16 binder_use(mediacodec)
Martijn Coenenfc80f482017-04-15 08:09:08 -070017 binder_service(mediacodec)
18 add_service(mediacodec, mediacodec_service)
19 allow mediacodec mediametrics_service:service_manager find;
20 allow mediacodec surfaceflinger_service:service_manager find;
Iliyan Malchev56cdcd42017-04-11 20:01:51 -070021')
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080022binder_call(mediacodec, binderservicedomain)
23binder_call(mediacodec, appdomain)
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080024
Martijn Coenenb4d701b2017-04-15 09:47:17 -070025# Allow mediacodec access to composer sync fences
26allow mediacodec hal_graphics_composer:fd use;
27
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080028allow mediacodec gpu_device:chr_file rw_file_perms;
29allow mediacodec video_device:chr_file rw_file_perms;
Robb Glasserb7a76e92016-02-11 10:33:57 -080030allow mediacodec video_device:dir search;
Marco Nelissenebf79f82016-02-24 10:03:25 -080031allow mediacodec ion_device:chr_file rw_file_perms;
Yin-Chia Yeh6824dfd2017-02-24 17:45:11 -080032allow mediacodec hal_camera:fd use;
33
Josh Gao12b47502017-03-06 18:13:05 -080034crash_dump_fallback(mediacodec)
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080035
Pawin Vongmasa19a74ec2018-03-28 21:09:23 -070036add_hwservice(mediacodec, hal_codec2_hwservice)
Alex Klyubin53656c12017-04-13 19:05:27 -070037add_hwservice(mediacodec, hal_omx_hwservice)
38
Alex Klyubin7cda44f2017-03-21 14:28:53 -070039hal_client_domain(mediacodec, hal_allocator)
Pawin Vongmasa5559d212017-01-24 02:45:16 -080040
Dan Cashman91d398d2017-09-26 12:58:29 -070041hal_client_domain(mediacodec, hal_cas)
42
Mathias Agopian9901ff72017-03-29 19:08:34 -070043# allocate and use graphic buffers
44hal_client_domain(mediacodec, hal_graphics_allocator)
45
Jiwen 'Steve' Caieeb0d382017-03-09 18:44:07 -080046# Recieve gralloc buffer FDs from bufferhubd. Note that mediacodec never
47# directly connects to bufferhubd via PDX. Instead, a VR app acts as a bridge
48# between those two: it talks to mediacodec via Binder and talks to bufferhubd
Alex Vakulenko41daa7f2017-05-01 13:01:44 -070049# via PDX. Thus, there is no need to use pdx_client macro.
Jiwen 'Steve' Caieeb0d382017-03-09 18:44:07 -080050allow mediacodec bufferhubd:fd use;
51
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080052###
53### neverallow rules
54###
55
56# mediacodec should never execute any executable without a
57# domain transition
58neverallow mediacodec { file_type fs_type }:file execute_no_trans;
59
Nick Kralevich38c12822017-02-16 12:34:51 -080060# The goal of the mediaserver split is to place media processing code into
61# restrictive sandboxes with limited responsibilities and thus limited
62# permissions. Example: Audioserver is only responsible for controlling audio
63# hardware and processing audio content. Cameraserver does the same for camera
64# hardware/content. Etc.
65#
66# Media processing code is inherently risky and thus should have limited
67# permissions and be isolated from the rest of the system and network.
68# Lengthier explanation here:
69# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
Jeff Vander Stoep21f77f62016-04-22 15:34:40 -070070neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *;