blob: a82cfecbd7c1950b0151c3e7daa4ed28dc4e2939 [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
Alex Klyubin238ce792017-02-07 10:47:18 -08005type audioserver_exec, exec_type, file_type;
dcashmancc39f632016-07-22 13:13:11 -07006init_daemon_domain(audioserver)
Alex Klyubin238ce792017-02-07 10:47:18 -08007
8r_dir_file(audioserver, sdcard_type)
9
10binder_use(audioserver)
11binder_call(audioserver, binderservicedomain)
12binder_call(audioserver, appdomain)
13binder_service(audioserver)
14
Alex Klyubin7cda44f2017-03-21 14:28:53 -070015hal_client_domain(audioserver, hal_allocator)
Alex Klyubin2d704462017-04-10 11:40:53 -070016# /system/lib64/hw for always-passthrough Allocator HAL ashmem / mapper .so
17r_dir_file(audioserver, system_file)
18
Alex Klyubinac2b4cd2017-02-13 14:40:49 -080019hal_client_domain(audioserver, hal_audio)
Alex Klyubin238ce792017-02-07 10:47:18 -080020
Alex Klyubin238ce792017-02-07 10:47:18 -080021userdebug_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 Klyubin238ce792017-02-07 10:47:18 -080031add_service(audioserver, audioserver_service)
Svet Ganovb9a1e7b2018-01-16 21:14:34 -080032allow audioserver activity_service:service_manager find;
Alex Klyubin238ce792017-02-07 10:47:18 -080033allow audioserver appops_service:service_manager find;
34allow audioserver batterystats_service:service_manager find;
35allow audioserver permission_service:service_manager find;
36allow audioserver power_service:service_manager find;
37allow audioserver scheduling_policy_service:service_manager find;
38
Aniket Kumar Latad3d78002018-01-31 20:20:08 -080039# Allow read/write access to bluetooth-specific properties
Jaekyun Seok224921d2018-04-09 12:07:32 +090040set_prop(audioserver, bluetooth_a2dp_offload_prop)
Aniket Kumar Latad3d78002018-01-31 20:20:08 -080041set_prop(audioserver, bluetooth_prop)
Jaekyun Seok224921d2018-04-09 12:07:32 +090042set_prop(audioserver, exported_bluetooth_prop)
Ajay Panickere32d9402018-02-27 11:43:23 -080043
Alex Klyubin238ce792017-02-07 10:47:18 -080044# Grant access to audio files to audioserver
45allow audioserver audio_data_file:dir ra_dir_perms;
46allow audioserver audio_data_file:file create_file_perms;
47
Phil Burk2b7f74e2017-04-19 13:21:27 -070048# allow access to ALSA MMAP FDs for AAudio API
49allow audioserver audio_device:chr_file { read write };
50
Joel Galenson6e8bfa22018-03-19 17:13:48 -070051not_full_treble(`allow audioserver audio_device:dir r_dir_perms;')
52not_full_treble(`allow audioserver audio_device:chr_file rw_file_perms;')
53
Mikhail Naganov9450a872017-04-27 18:54:52 -070054# For A2DP bridge which is loaded directly into audioserver
55unix_socket_connect(audioserver, bluetooth, bluetooth)
56
Mikhail Naganov05e12db2018-04-06 14:52:15 -070057# Allow shell commands from ADB and shell for CTS testing/dumping
Svet Ganovb9a1e7b2018-01-16 21:14:34 -080058allow audioserver adbd:fd use;
59allow audioserver adbd:unix_stream_socket { read write };
Mikhail Naganov05e12db2018-04-06 14:52:15 -070060allow audioserver shell:fifo_file { read write };
Svet Ganovb9a1e7b2018-01-16 21:14:34 -080061
62# Allow shell commands from ADB for CTS testing/dumping
63userdebug_or_eng(`
64 allow audioserver su:fd use;
65 allow audioserver su:fifo_file { read write };
66 allow audioserver su:unix_stream_socket { read write };
67')
68
Alex Klyubin238ce792017-02-07 10:47:18 -080069###
70### neverallow rules
71###
72
73# audioserver should never execute any executable without a
74# domain transition
75neverallow audioserver { file_type fs_type }:file execute_no_trans;
76
Nick Kralevich38c12822017-02-16 12:34:51 -080077# The goal of the mediaserver split is to place media processing code into
78# restrictive sandboxes with limited responsibilities and thus limited
79# permissions. Example: Audioserver is only responsible for controlling audio
80# hardware and processing audio content. Cameraserver does the same for camera
81# hardware/content. Etc.
82#
83# Media processing code is inherently risky and thus should have limited
84# permissions and be isolated from the rest of the system and network.
85# Lengthier explanation here:
86# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
Alex Klyubin238ce792017-02-07 10:47:18 -080087neverallow audioserver domain:{ tcp_socket udp_socket rawip_socket } *;