platform_system_sepolicy/public/mediametrics.te
Ray Essick 7218698d5a allow media.metrics to write to file descriptor in /data
when GMSCore collects information for uploading via 'dumpsys
media.metrics', it provides the metrics service with a file descriptor
to hold the data, which is post-processed by the log collecting code
in GMScore.  This temp file lives in /data/, a place where our
restrictive policies for media.metrics doesn't allow any writing.

This relaxes the restrictions -- allowing media.metrics to
write to already open file descriptors it might be given on that
partition.

Bug: 36660639
Test: build/boot
Change-Id: Icbaa76b04ecf731014b6b1bb1283bc2951a6ae4b
2017-04-04 10:30:50 -07:00

38 lines
1.3 KiB
Text

# mediametrics - daemon for collecting media.metrics data
type mediametrics, domain;
type mediametrics_exec, exec_type, file_type;
binder_use(mediametrics)
binder_call(mediametrics, binderservicedomain)
binder_service(mediametrics)
add_service(mediametrics, mediametrics_service)
allow mediametrics system_server:fd use;
r_dir_file(mediametrics, cgroup)
allow mediametrics proc_meminfo:file r_file_perms;
# allows interactions with dumpsys to GMScore
allow mediametrics app_data_file:file write;
###
### neverallow rules
###
# mediametrics should never execute any executable without a
# domain transition
neverallow mediametrics { file_type fs_type }:file execute_no_trans;
# The goal of the mediaserver split is to place media processing code into
# restrictive sandboxes with limited responsibilities and thus limited
# permissions. Example: Audioserver is only responsible for controlling audio
# hardware and processing audio content. Cameraserver does the same for camera
# hardware/content. Etc.
#
# Media processing code is inherently risky and thus should have limited
# permissions and be isolated from the rest of the system and network.
# Lengthier explanation here:
# https://android-developers.googleblog.com/2016/05/hardening-media-stack.html
neverallow mediametrics domain:{ tcp_socket udp_socket rawip_socket } *;