blob: 1eaddac1c024ca2a1cbae0c25b9c3bd3616e581e [file] [log] [blame]
Alex Klyubin238ce792017-02-07 10:47:18 -08001# audioserver - audio services daemon
2
Alex Klyubinf5446eb2017-03-23 14:27:32 -07003typeattribute audioserver coredomain;
4
Nick Kralevich5e372712018-09-27 10:21:37 -07005type audioserver_exec, exec_type, file_type, system_file_type;
dcashmancc39f632016-07-22 13:13:11 -07006init_daemon_domain(audioserver)
Jeff Vander Stoepe16fb912019-01-23 15:07:40 -08007tmpfs_domain(audioserver)
Alex Klyubin238ce792017-02-07 10:47:18 -08008
9r_dir_file(audioserver, sdcard_type)
10
11binder_use(audioserver)
12binder_call(audioserver, binderservicedomain)
13binder_call(audioserver, appdomain)
14binder_service(audioserver)
15
Alex Klyubin7cda44f2017-03-21 14:28:53 -070016hal_client_domain(audioserver, hal_allocator)
Alex Klyubin2d704462017-04-10 11:40:53 -070017# /system/lib64/hw for always-passthrough Allocator HAL ashmem / mapper .so
18r_dir_file(audioserver, system_file)
19
Alex Klyubinac2b4cd2017-02-13 14:40:49 -080020hal_client_domain(audioserver, hal_audio)
Alex Klyubin238ce792017-02-07 10:47:18 -080021
Alex Klyubin238ce792017-02-07 10:47:18 -080022userdebug_or_eng(`
23 # used for TEE sink - pcm capture for debug.
24 allow audioserver media_data_file:dir create_dir_perms;
25 allow audioserver audioserver_data_file:dir create_dir_perms;
26 allow audioserver audioserver_data_file:file create_file_perms;
27
28 # ptrace to processes in the same domain for memory leak detection
29 allow audioserver self:process ptrace;
30')
31
Alex Klyubin238ce792017-02-07 10:47:18 -080032add_service(audioserver, audioserver_service)
Svet Ganovb9a1e7b2018-01-16 21:14:34 -080033allow audioserver activity_service:service_manager find;
Alex Klyubin238ce792017-02-07 10:47:18 -080034allow audioserver appops_service:service_manager find;
35allow audioserver batterystats_service:service_manager find;
Michael Wrighte9f16682019-01-22 20:55:08 +000036allow audioserver external_vibrator_service:service_manager find;
Kevin Rocard25f60572019-02-23 11:41:26 -080037allow audioserver package_native_service:service_manager find;
Alex Klyubin238ce792017-02-07 10:47:18 -080038allow audioserver permission_service:service_manager find;
39allow audioserver power_service:service_manager find;
40allow audioserver scheduling_policy_service:service_manager find;
Ray Essickb85e3822018-05-07 13:30:53 -070041allow audioserver mediametrics_service:service_manager find;
Michael Groover1f6b9192018-12-17 21:33:15 -080042allow audioserver sensor_privacy_service:service_manager find;
Alex Klyubin238ce792017-02-07 10:47:18 -080043
Aniket Kumar Latad3d78002018-01-31 20:20:08 -080044# Allow read/write access to bluetooth-specific properties
Jaekyun Seok224921d2018-04-09 12:07:32 +090045set_prop(audioserver, bluetooth_a2dp_offload_prop)
Aniket Kumar Latad3d78002018-01-31 20:20:08 -080046set_prop(audioserver, bluetooth_prop)
Jaekyun Seok224921d2018-04-09 12:07:32 +090047set_prop(audioserver, exported_bluetooth_prop)
Ajay Panickere32d9402018-02-27 11:43:23 -080048
Alex Klyubin238ce792017-02-07 10:47:18 -080049# Grant access to audio files to audioserver
50allow audioserver audio_data_file:dir ra_dir_perms;
51allow audioserver audio_data_file:file create_file_perms;
52
Phil Burk2b7f74e2017-04-19 13:21:27 -070053# allow access to ALSA MMAP FDs for AAudio API
54allow audioserver audio_device:chr_file { read write };
55
Joel Galenson6e8bfa22018-03-19 17:13:48 -070056not_full_treble(`allow audioserver audio_device:dir r_dir_perms;')
57not_full_treble(`allow audioserver audio_device:chr_file rw_file_perms;')
58
Mikhail Naganov9450a872017-04-27 18:54:52 -070059# For A2DP bridge which is loaded directly into audioserver
60unix_socket_connect(audioserver, bluetooth, bluetooth)
61
Mikhail Naganov05e12db2018-04-06 14:52:15 -070062# Allow shell commands from ADB and shell for CTS testing/dumping
Svet Ganovb9a1e7b2018-01-16 21:14:34 -080063allow audioserver adbd:fd use;
64allow audioserver adbd:unix_stream_socket { read write };
Mikhail Naganov05e12db2018-04-06 14:52:15 -070065allow audioserver shell:fifo_file { read write };
Svet Ganovb9a1e7b2018-01-16 21:14:34 -080066
67# Allow shell commands from ADB for CTS testing/dumping
68userdebug_or_eng(`
69 allow audioserver su:fd use;
70 allow audioserver su:fifo_file { read write };
71 allow audioserver su:unix_stream_socket { read write };
72')
73
Tomoharu Kasahara0a650412018-11-08 15:54:02 +090074# Allow write access to log tag property
75set_prop(audioserver, log_tag_prop);
76
Alex Klyubin238ce792017-02-07 10:47:18 -080077###
78### neverallow rules
79###
80
81# audioserver should never execute any executable without a
82# domain transition
83neverallow audioserver { file_type fs_type }:file execute_no_trans;
84
Nick Kralevich38c12822017-02-16 12:34:51 -080085# The goal of the mediaserver split is to place media processing code into
86# restrictive sandboxes with limited responsibilities and thus limited
87# permissions. Example: Audioserver is only responsible for controlling audio
88# hardware and processing audio content. Cameraserver does the same for camera
89# hardware/content. Etc.
90#
91# Media processing code is inherently risky and thus should have limited
92# permissions and be isolated from the rest of the system and network.
93# Lengthier explanation here:
94# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
Alex Klyubin238ce792017-02-07 10:47:18 -080095neverallow audioserver domain:{ tcp_socket udp_socket rawip_socket } *;
Tri Voef811022018-05-17 17:27:54 -070096
97# Allow using wake locks
98wakelock_use(audioserver)