2012-01-04 18:33:27 +01:00
|
|
|
# mediaserver - multimedia daemon
|
2016-10-01 14:26:15 +02:00
|
|
|
type mediaserver, domain;
|
2018-09-27 19:21:37 +02:00
|
|
|
type mediaserver_exec, system_file_type, exec_type, file_type;
|
2019-01-24 00:07:40 +01:00
|
|
|
type mediaserver_tmpfs, file_type;
|
2012-01-04 18:33:27 +01:00
|
|
|
|
2013-10-23 20:23:43 +02:00
|
|
|
typeattribute mediaserver mlstrustedsubject;
|
|
|
|
|
2012-11-28 21:18:30 +01:00
|
|
|
net_domain(mediaserver)
|
2013-10-23 20:23:43 +02:00
|
|
|
|
|
|
|
r_dir_file(mediaserver, sdcard_type)
|
2021-06-23 10:21:49 +02:00
|
|
|
r_dir_file(mediaserver, fuse)
|
2016-10-01 14:26:15 +02:00
|
|
|
r_dir_file(mediaserver, cgroup)
|
2021-02-12 00:18:11 +01:00
|
|
|
r_dir_file(mediaserver, cgroup_v2)
|
2013-10-23 20:23:43 +02:00
|
|
|
|
2016-01-28 04:31:45 +01:00
|
|
|
# stat /proc/self
|
|
|
|
allow mediaserver proc:lnk_file getattr;
|
|
|
|
|
|
|
|
# open /vendor/lib/mediadrm
|
|
|
|
allow mediaserver system_file:dir r_dir_perms;
|
|
|
|
|
2016-04-14 01:00:47 +02:00
|
|
|
userdebug_or_eng(`
|
|
|
|
# ptrace to processes in the same domain for memory leak detection
|
|
|
|
allow mediaserver self:process ptrace;
|
|
|
|
')
|
|
|
|
|
2013-10-23 20:23:43 +02:00
|
|
|
binder_use(mediaserver)
|
|
|
|
binder_call(mediaserver, binderservicedomain)
|
2017-01-19 19:56:18 +01:00
|
|
|
binder_call(mediaserver, appdomain)
|
2013-10-23 20:23:43 +02:00
|
|
|
binder_service(mediaserver)
|
|
|
|
|
2014-01-21 21:37:28 +01:00
|
|
|
allow mediaserver media_data_file:dir create_dir_perms;
|
2013-11-04 15:50:52 +01:00
|
|
|
allow mediaserver media_data_file:file create_file_perms;
|
2018-09-23 07:28:20 +02:00
|
|
|
allow mediaserver { app_data_file privapp_data_file }:file { append getattr ioctl lock map read write };
|
2021-06-23 10:21:49 +02:00
|
|
|
allow mediaserver { sdcard_type fuse }:file write;
|
2014-05-14 20:04:16 +02:00
|
|
|
allow mediaserver gpu_device:chr_file rw_file_perms;
|
2022-02-24 19:32:16 +01:00
|
|
|
allow mediaserver gpu_device:dir r_dir_perms;
|
2014-01-06 21:39:19 +01:00
|
|
|
allow mediaserver video_device:dir r_dir_perms;
|
2013-10-23 20:23:43 +02:00
|
|
|
allow mediaserver video_device:chr_file rw_file_perms;
|
2015-05-05 03:22:45 +02:00
|
|
|
|
2014-03-13 20:35:46 +01:00
|
|
|
# Read resources from open apk files passed over Binder.
|
2014-02-04 17:36:41 +01:00
|
|
|
allow mediaserver apk_data_file:file { read getattr };
|
2014-03-13 20:35:46 +01:00
|
|
|
allow mediaserver asec_apk_file:file { read getattr };
|
2016-02-23 01:50:01 +01:00
|
|
|
allow mediaserver ringtone_file:file { read getattr };
|
2013-10-23 20:23:43 +02:00
|
|
|
|
2014-03-27 14:45:26 +01:00
|
|
|
# Read /data/data/com.android.providers.telephony files passed over Binder.
|
|
|
|
allow mediaserver radio_data_file:file { read getattr };
|
|
|
|
|
2014-05-13 14:07:31 +02:00
|
|
|
# Use pipes passed over Binder from app domains.
|
2017-01-19 19:56:18 +01:00
|
|
|
allow mediaserver appdomain:fifo_file { getattr read write };
|
2014-05-13 14:07:31 +02:00
|
|
|
|
2013-10-23 20:23:43 +02:00
|
|
|
allow mediaserver rpmsg_device:chr_file rw_file_perms;
|
|
|
|
|
|
|
|
# Inter System processes communicate over named pipe (FIFO)
|
|
|
|
allow mediaserver system_server:fifo_file r_file_perms;
|
|
|
|
|
2014-01-06 21:39:19 +01:00
|
|
|
r_dir_file(mediaserver, media_rw_data_file)
|
2013-10-23 20:23:43 +02:00
|
|
|
|
2016-01-28 07:48:39 +01:00
|
|
|
# Grant access to read files on appfuse.
|
|
|
|
allow mediaserver app_fuse_file:file { read getattr };
|
|
|
|
|
2014-01-08 20:19:52 +01:00
|
|
|
# Needed on some devices for playing DRM protected content,
|
|
|
|
# but seems expected and appropriate for all devices.
|
|
|
|
unix_socket_connect(mediaserver, drmserver, drmserver)
|
2014-01-13 15:14:15 +01:00
|
|
|
|
|
|
|
# Needed on some devices for playing audio on paired BT device,
|
|
|
|
# but seems appropriate for all devices.
|
|
|
|
unix_socket_connect(mediaserver, bluetooth, bluetooth)
|
2014-03-06 21:00:59 +01:00
|
|
|
|
2017-01-19 22:23:52 +01:00
|
|
|
add_service(mediaserver, mediaserver_service)
|
2015-04-03 23:24:02 +02:00
|
|
|
allow mediaserver activity_service:service_manager find;
|
|
|
|
allow mediaserver appops_service:service_manager find;
|
2019-04-22 21:16:31 +02:00
|
|
|
allow mediaserver audio_service:service_manager find;
|
2015-09-09 19:48:04 +02:00
|
|
|
allow mediaserver audioserver_service:service_manager find;
|
2016-02-17 20:54:55 +01:00
|
|
|
allow mediaserver cameraserver_service:service_manager find;
|
2015-04-04 01:11:01 +02:00
|
|
|
allow mediaserver batterystats_service:service_manager find;
|
2014-12-12 01:01:27 +01:00
|
|
|
allow mediaserver drmserver_service:service_manager find;
|
2015-09-22 19:56:03 +02:00
|
|
|
allow mediaserver mediaextractor_service:service_manager find;
|
2017-01-24 21:53:45 +01:00
|
|
|
allow mediaserver mediametrics_service:service_manager find;
|
2015-12-15 06:19:21 +01:00
|
|
|
allow mediaserver media_session_service:service_manager find;
|
2022-11-19 16:59:57 +01:00
|
|
|
allow mediaserver package_native_service:service_manager find;
|
2015-04-08 22:04:59 +02:00
|
|
|
allow mediaserver permission_service:service_manager find;
|
2021-05-20 18:15:31 +02:00
|
|
|
allow mediaserver permission_checker_service:service_manager find;
|
2015-04-08 22:04:59 +02:00
|
|
|
allow mediaserver power_service:service_manager find;
|
|
|
|
allow mediaserver processinfo_service:service_manager find;
|
2015-04-09 00:12:24 +02:00
|
|
|
allow mediaserver scheduling_policy_service:service_manager find;
|
2014-12-12 01:01:27 +01:00
|
|
|
allow mediaserver surfaceflinger_service:service_manager find;
|
2014-07-07 22:56:27 +02:00
|
|
|
|
2017-01-25 21:26:37 +01:00
|
|
|
# for ModDrm/MediaPlayer
|
|
|
|
allow mediaserver mediadrmserver_service:service_manager find;
|
|
|
|
|
2019-04-30 14:09:28 +02:00
|
|
|
# For hybrid interfaces
|
2017-04-14 04:05:27 +02:00
|
|
|
allow mediaserver hidl_token_hwservice:hwservice_manager find;
|
|
|
|
|
2014-09-16 19:00:50 +02:00
|
|
|
# /oem access
|
2014-10-11 01:11:03 +02:00
|
|
|
allow mediaserver oemfs:dir search;
|
2014-09-16 19:00:50 +02:00
|
|
|
allow mediaserver oemfs:file r_file_perms;
|
2014-09-16 22:04:06 +02:00
|
|
|
|
2018-04-24 05:47:05 +02:00
|
|
|
# /vendor apk access
|
2018-10-18 05:09:19 +02:00
|
|
|
allow mediaserver vendor_app_file:file { read map getattr };
|
2018-04-24 05:47:05 +02:00
|
|
|
|
2014-07-02 21:42:59 +02:00
|
|
|
use_drmservice(mediaserver)
|
|
|
|
allow mediaserver drmserver:drmservice {
|
|
|
|
consumeRights
|
|
|
|
setPlaybackStatus
|
|
|
|
openDecryptSession
|
|
|
|
closeDecryptSession
|
|
|
|
initializeDecryptUnit
|
|
|
|
decrypt
|
|
|
|
finalizeDecryptUnit
|
|
|
|
pread
|
|
|
|
};
|
2015-08-14 07:33:49 +02:00
|
|
|
|
2016-01-06 20:32:07 +01:00
|
|
|
# only allow unprivileged socket ioctl commands
|
2016-02-22 21:31:57 +01:00
|
|
|
allowxperm mediaserver self:{ rawip_socket tcp_socket udp_socket }
|
|
|
|
ioctl { unpriv_sock_ioctls unpriv_tty_ioctls };
|
2016-01-06 20:32:07 +01:00
|
|
|
|
2016-03-31 22:53:42 +02:00
|
|
|
# Access to /data/media.
|
|
|
|
# This should be removed if sdcardfs is modified to alter the secontext for its
|
|
|
|
# accesses to the underlying FS.
|
|
|
|
allow mediaserver media_rw_data_file:dir create_dir_perms;
|
|
|
|
allow mediaserver media_rw_data_file:file create_file_perms;
|
|
|
|
|
2017-03-14 19:42:03 +01:00
|
|
|
# Access to media in /data/preloads
|
|
|
|
allow mediaserver preloads_media_file:file { getattr read ioctl };
|
2016-05-26 20:55:24 +02:00
|
|
|
|
2016-09-10 01:27:17 +02:00
|
|
|
allow mediaserver ion_device:chr_file r_file_perms;
|
2020-09-19 05:22:57 +02:00
|
|
|
allow mediaserver dmabuf_system_heap_device:chr_file r_file_perms;
|
2021-01-12 21:05:20 +01:00
|
|
|
allow mediaserver dmabuf_system_secure_heap_device:chr_file r_file_perms;
|
2016-10-12 15:38:00 +02:00
|
|
|
allow mediaserver hal_graphics_allocator:fd use;
|
2017-04-29 02:44:34 +02:00
|
|
|
allow mediaserver hal_graphics_composer:fd use;
|
2017-02-25 02:45:11 +01:00
|
|
|
allow mediaserver hal_camera:fd use;
|
2016-10-12 15:38:00 +02:00
|
|
|
|
2016-09-10 01:27:17 +02:00
|
|
|
allow mediaserver system_server:fd use;
|
|
|
|
|
2019-03-22 15:36:28 +01:00
|
|
|
# b/120491318 allow mediaserver to access void:fd
|
|
|
|
allow mediaserver vold:fd use;
|
|
|
|
|
2020-04-23 16:38:43 +02:00
|
|
|
# overlay package access
|
|
|
|
allow mediaserver vendor_overlay_file:file { read getattr map };
|
|
|
|
|
Mark all clients of Allocator HAL
This change associates all domains which are clients of Allocator HAL
with hal_allocator_client and the, required for all HAL client
domains, halclientdomain.
This enables this commit to remove the now unnecessary hwallocator_use
macro because its binder_call(..., hal_allocator_server) is covered by
binder_call(hal_allocator_client, hal_allocator_server) added in this
commit.
Unfortunately apps, except isolated app, are clients of Allocator HAL
as well. This makes it hard to use the hal_client_domain(...,
hal_allocator) macro because it translates into "typeattribute" which
currently does not support being provided with a set of types, such as
{ appdomain -isolated_app }. As a workaround, hopefully until
typeattribute is improved, this commit expresses the necessary
association operation in CIL. private/technical_debt.cil introduced by
this commit is appended into the platform policy CIL file, thus
ensuring that the hack has effect on the final monolithic policy.
P. S. This change also removes Allocator HAL access from isolated_app.
Isolated app shouldn't have access to this HAL anyway.
Test: Google Play Music plays back radios
Test: Google Camera records video with sound and that video is then
successfully played back with sound
Test: YouTube app plays back clips with sound
Test: YouTube in Chrome plays back clips with sound
Bug: 34170079
Change-Id: Id00bba6fde83e7cf04fb58bc1c353c2f66333f92
2017-03-21 22:28:53 +01:00
|
|
|
hal_client_domain(mediaserver, hal_allocator)
|
2017-01-24 11:45:16 +01:00
|
|
|
|
2015-08-14 07:33:49 +02:00
|
|
|
###
|
|
|
|
### neverallow rules
|
|
|
|
###
|
|
|
|
|
|
|
|
# mediaserver should never execute any executable without a
|
|
|
|
# domain transition
|
|
|
|
neverallow mediaserver { file_type fs_type }:file execute_no_trans;
|
2016-01-06 20:32:07 +01:00
|
|
|
|
|
|
|
# do not allow privileged socket ioctl commands
|
|
|
|
neverallowxperm mediaserver domain:{ rawip_socket tcp_socket udp_socket } ioctl priv_sock_ioctls;
|