Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 1 | # audioserver - audio services daemon |
| 2 | |
Alex Klyubin | f5446eb | 2017-03-23 14:27:32 -0700 | [diff] [blame] | 3 | typeattribute audioserver coredomain; |
| 4 | |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 5 | type audioserver_exec, exec_type, file_type; |
dcashman | cc39f63 | 2016-07-22 13:13:11 -0700 | [diff] [blame] | 6 | init_daemon_domain(audioserver) |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 7 | |
| 8 | r_dir_file(audioserver, sdcard_type) |
| 9 | |
| 10 | binder_use(audioserver) |
| 11 | binder_call(audioserver, binderservicedomain) |
| 12 | binder_call(audioserver, appdomain) |
| 13 | binder_service(audioserver) |
| 14 | |
Alex Klyubin | 7cda44f | 2017-03-21 14:28:53 -0700 | [diff] [blame] | 15 | hal_client_domain(audioserver, hal_allocator) |
Alex Klyubin | 2d70446 | 2017-04-10 11:40:53 -0700 | [diff] [blame^] | 16 | # /system/lib64/hw for always-passthrough Allocator HAL ashmem / mapper .so |
| 17 | r_dir_file(audioserver, system_file) |
| 18 | |
Alex Klyubin | ac2b4cd | 2017-02-13 14:40:49 -0800 | [diff] [blame] | 19 | hal_client_domain(audioserver, hal_audio) |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 20 | |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 21 | userdebug_or_eng(` |
| 22 | # used for TEE sink - pcm capture for debug. |
| 23 | allow audioserver media_data_file:dir create_dir_perms; |
| 24 | allow audioserver audioserver_data_file:dir create_dir_perms; |
| 25 | allow audioserver audioserver_data_file:file create_file_perms; |
| 26 | |
| 27 | # ptrace to processes in the same domain for memory leak detection |
| 28 | allow audioserver self:process ptrace; |
| 29 | ') |
| 30 | |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 31 | add_service(audioserver, audioserver_service) |
| 32 | allow audioserver appops_service:service_manager find; |
| 33 | allow audioserver batterystats_service:service_manager find; |
| 34 | allow audioserver permission_service:service_manager find; |
| 35 | allow audioserver power_service:service_manager find; |
| 36 | allow audioserver scheduling_policy_service:service_manager find; |
| 37 | |
| 38 | # Grant access to audio files to audioserver |
| 39 | allow audioserver audio_data_file:dir ra_dir_perms; |
| 40 | allow audioserver audio_data_file:file create_file_perms; |
| 41 | |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 42 | ### |
| 43 | ### neverallow rules |
| 44 | ### |
| 45 | |
| 46 | # audioserver should never execute any executable without a |
| 47 | # domain transition |
| 48 | neverallow audioserver { file_type fs_type }:file execute_no_trans; |
| 49 | |
Nick Kralevich | 38c1282 | 2017-02-16 12:34:51 -0800 | [diff] [blame] | 50 | # The goal of the mediaserver split is to place media processing code into |
| 51 | # restrictive sandboxes with limited responsibilities and thus limited |
| 52 | # permissions. Example: Audioserver is only responsible for controlling audio |
| 53 | # hardware and processing audio content. Cameraserver does the same for camera |
| 54 | # hardware/content. Etc. |
| 55 | # |
| 56 | # Media processing code is inherently risky and thus should have limited |
| 57 | # permissions and be isolated from the rest of the system and network. |
| 58 | # Lengthier explanation here: |
| 59 | # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html |
Alex Klyubin | 238ce79 | 2017-02-07 10:47:18 -0800 | [diff] [blame] | 60 | neverallow audioserver domain:{ tcp_socket udp_socket rawip_socket } *; |