Marco Nelissen | c3ba2e5 | 2016-02-02 16:10:37 -0800 | [diff] [blame] | 1 | # mediacodec - audio and video codecs live here |
| 2 | type mediacodec, domain; |
| 3 | type mediacodec_exec, exec_type, file_type; |
| 4 | |
| 5 | typeattribute mediacodec mlstrustedsubject; |
| 6 | |
Steven Moreland | d3ce5dc | 2017-03-22 09:16:49 -0700 | [diff] [blame^] | 7 | # TODO(b/36375899) attributize this domain appropriately as hal_omx |
| 8 | # and use macro hal_server_domain |
| 9 | get_prop(mediacodec, hwservicemanager_prop) |
| 10 | |
Marco Nelissen | c3ba2e5 | 2016-02-02 16:10:37 -0800 | [diff] [blame] | 11 | binder_use(mediacodec) |
| 12 | binder_call(mediacodec, binderservicedomain) |
| 13 | binder_call(mediacodec, appdomain) |
| 14 | binder_service(mediacodec) |
| 15 | |
William Roberts | 606d2fd | 2017-01-19 13:23:52 -0800 | [diff] [blame] | 16 | add_service(mediacodec, mediacodec_service) |
Ray Essick | 3918540 | 2017-01-24 12:53:45 -0800 | [diff] [blame] | 17 | allow mediacodec mediametrics_service:service_manager find; |
Marco Nelissen | 6c53b23 | 2016-02-27 21:25:03 -0800 | [diff] [blame] | 18 | allow mediacodec surfaceflinger_service:service_manager find; |
Marco Nelissen | c3ba2e5 | 2016-02-02 16:10:37 -0800 | [diff] [blame] | 19 | allow mediacodec gpu_device:chr_file rw_file_perms; |
| 20 | allow mediacodec video_device:chr_file rw_file_perms; |
Robb Glasser | b7a76e9 | 2016-02-11 10:33:57 -0800 | [diff] [blame] | 21 | allow mediacodec video_device:dir search; |
Marco Nelissen | ebf79f8 | 2016-02-24 10:03:25 -0800 | [diff] [blame] | 22 | allow mediacodec ion_device:chr_file rw_file_perms; |
Chia-I Wu | dd958e5 | 2016-10-12 06:38:00 -0700 | [diff] [blame] | 23 | allow mediacodec hal_graphics_allocator:fd use; |
Yin-Chia Yeh | 6824dfd | 2017-02-24 17:45:11 -0800 | [diff] [blame] | 24 | allow mediacodec hal_camera:fd use; |
| 25 | |
Josh Gao | 12b4750 | 2017-03-06 18:13:05 -0800 | [diff] [blame] | 26 | crash_dump_fallback(mediacodec) |
Marco Nelissen | c3ba2e5 | 2016-02-02 16:10:37 -0800 | [diff] [blame] | 27 | |
Pawin Vongmasa | 5559d21 | 2017-01-24 02:45:16 -0800 | [diff] [blame] | 28 | # hidl access |
| 29 | hwbinder_use(mediacodec) |
| 30 | hwallocator_use(mediacodec) |
| 31 | allow mediacodec system_file:dir { open read }; |
| 32 | |
Jiwen 'Steve' Cai | eeb0d38 | 2017-03-09 18:44:07 -0800 | [diff] [blame] | 33 | # Recieve gralloc buffer FDs from bufferhubd. Note that mediacodec never |
| 34 | # directly connects to bufferhubd via PDX. Instead, a VR app acts as a bridge |
| 35 | # between those two: it talks to mediacodec via Binder and talks to bufferhubd |
| 36 | # via PDX. Thus, there is no need to use use_pdx macro. |
| 37 | allow mediacodec bufferhubd:fd use; |
| 38 | |
Marco Nelissen | c3ba2e5 | 2016-02-02 16:10:37 -0800 | [diff] [blame] | 39 | ### |
| 40 | ### neverallow rules |
| 41 | ### |
| 42 | |
| 43 | # mediacodec should never execute any executable without a |
| 44 | # domain transition |
| 45 | neverallow mediacodec { file_type fs_type }:file execute_no_trans; |
| 46 | |
Nick Kralevich | 38c1282 | 2017-02-16 12:34:51 -0800 | [diff] [blame] | 47 | # The goal of the mediaserver split is to place media processing code into |
| 48 | # restrictive sandboxes with limited responsibilities and thus limited |
| 49 | # permissions. Example: Audioserver is only responsible for controlling audio |
| 50 | # hardware and processing audio content. Cameraserver does the same for camera |
| 51 | # hardware/content. Etc. |
| 52 | # |
| 53 | # Media processing code is inherently risky and thus should have limited |
| 54 | # permissions and be isolated from the rest of the system and network. |
| 55 | # Lengthier explanation here: |
| 56 | # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html |
Jeff Vander Stoep | 21f77f6 | 2016-04-22 15:34:40 -0700 | [diff] [blame] | 57 | neverallow mediacodec domain:{ tcp_socket udp_socket rawip_socket } *; |