blob: 6ab90eb3ddca40b1518e3782c60ffeac7f44c95d [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
Marco Nelissenc3ba2e52016-02-02 16:10:37 -08007binder_use(mediacodec)
8binder_call(mediacodec, binderservicedomain)
9binder_call(mediacodec, appdomain)
10binder_service(mediacodec)
11
William Roberts606d2fd2017-01-19 13:23:52 -080012add_service(mediacodec, mediacodec_service)
Ray Essick39185402017-01-24 12:53:45 -080013allow mediacodec mediametrics_service:service_manager find;
Marco Nelissen6c53b232016-02-27 21:25:03 -080014allow mediacodec surfaceflinger_service:service_manager find;
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080015allow mediacodec gpu_device:chr_file rw_file_perms;
16allow mediacodec video_device:chr_file rw_file_perms;
Robb Glasserb7a76e92016-02-11 10:33:57 -080017allow mediacodec video_device:dir search;
Marco Nelissenebf79f82016-02-24 10:03:25 -080018allow mediacodec ion_device:chr_file rw_file_perms;
Chia-I Wudd958e52016-10-12 06:38:00 -070019allow mediacodec hal_graphics_allocator:fd use;
Yin-Chia Yeh6824dfd2017-02-24 17:45:11 -080020allow mediacodec hal_camera:fd use;
21
Josh Gao12b47502017-03-06 18:13:05 -080022crash_dump_fallback(mediacodec)
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080023
Pawin Vongmasa5559d212017-01-24 02:45:16 -080024# hidl access
25hwbinder_use(mediacodec)
26hwallocator_use(mediacodec)
27allow mediacodec system_file:dir { open read };
28
Jiwen 'Steve' Caieeb0d382017-03-09 18:44:07 -080029# Recieve gralloc buffer FDs from bufferhubd. Note that mediacodec never
30# directly connects to bufferhubd via PDX. Instead, a VR app acts as a bridge
31# between those two: it talks to mediacodec via Binder and talks to bufferhubd
32# via PDX. Thus, there is no need to use use_pdx macro.
33allow mediacodec bufferhubd:fd use;
34
Marco Nelissenc3ba2e52016-02-02 16:10:37 -080035###
36### neverallow rules
37###
38
39# mediacodec should never execute any executable without a
40# domain transition
41neverallow mediacodec { file_type fs_type }:file execute_no_trans;
42
Nick Kralevich38c12822017-02-16 12:34:51 -080043# The goal of the mediaserver split is to place media processing code into
44# restrictive sandboxes with limited responsibilities and thus limited
45# permissions. Example: Audioserver is only responsible for controlling audio
46# hardware and processing audio content. Cameraserver does the same for camera
47# hardware/content. Etc.
48#
49# Media processing code is inherently risky and thus should have limited
50# permissions and be isolated from the rest of the system and network.
51# Lengthier explanation here:
52# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
Jeff Vander Stoep21f77f62016-04-22 15:34:40 -070053neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *;