23c9d91b46
Currently, both untrusted apps and priv-apps use the SELinux file label "app_data_file" for files in their /data/data directory. This is problematic, as we really want different rules for such files. For example, we may want to allow untrusted apps to load executable code from priv-app directories, but disallow untrusted apps from loading executable code from their own home directories. This change adds a new file type "privapp_data_file". For compatibility, we adjust the policy to support access privapp_data_files almost everywhere we were previously granting access to app_data_files (adbd and run-as being exceptions). Additional future tightening is possible here by removing some of these newly added rules. This label will start getting used in a followup change to system/sepolicy/private/seapp_contexts, similar to: -user=_app isPrivApp=true domain=priv_app type=app_data_file levelFrom=user +user=_app isPrivApp=true domain=priv_app type=privapp_data_file levelFrom=user For now, this newly introduced label has no usage, so this change is essentially a no-op. Test: Factory reset and boot - no problems on fresh install. Test: Upgrade to new version and test. No compatibility problems on filesystem upgrade. Change-Id: I9618b7d91d1c2bcb5837cdabc949f0cf741a2837
41 lines
1.4 KiB
Text
41 lines
1.4 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 privapp_data_file }:file write;
|
|
|
|
# allow access to package manager for uid->apk mapping
|
|
allow mediametrics package_native_service:service_manager find;
|
|
|
|
###
|
|
### 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 } *;
|