Inseob Kim | ff43be2 | 2021-06-07 16:56:56 +0900 | [diff] [blame] | 1 | # mediametrics - daemon for collecting media.metrics data |
| 2 | type mediametrics, domain; |
| 3 | type mediametrics_exec, system_file_type, exec_type, file_type; |
| 4 | |
| 5 | |
| 6 | binder_use(mediametrics) |
| 7 | binder_call(mediametrics, binderservicedomain) |
| 8 | binder_service(mediametrics) |
| 9 | |
| 10 | add_service(mediametrics, mediametrics_service) |
| 11 | |
| 12 | allow mediametrics system_server:fd use; |
| 13 | |
| 14 | r_dir_file(mediametrics, cgroup) |
| 15 | r_dir_file(mediametrics, cgroup_v2) |
| 16 | allow mediametrics proc_meminfo:file r_file_perms; |
| 17 | |
| 18 | # allows interactions with dumpsys to GMScore |
| 19 | allow mediametrics { app_data_file privapp_data_file }:file write; |
| 20 | |
| 21 | # allow access to package manager for uid->apk mapping |
| 22 | allow mediametrics package_native_service:service_manager find; |
| 23 | |
| 24 | # Allow metrics service to send information to statsd socket. |
| 25 | unix_socket_send(mediametrics, statsdw, statsd) |
| 26 | |
| 27 | ### |
| 28 | ### neverallow rules |
| 29 | ### |
| 30 | |
| 31 | # mediametrics should never execute any executable without a |
| 32 | # domain transition |
| 33 | neverallow mediametrics { file_type fs_type }:file execute_no_trans; |
| 34 | |
| 35 | # The goal of the mediaserver split is to place media processing code into |
| 36 | # restrictive sandboxes with limited responsibilities and thus limited |
| 37 | # permissions. Example: Audioserver is only responsible for controlling audio |
| 38 | # hardware and processing audio content. Cameraserver does the same for camera |
| 39 | # hardware/content. Etc. |
| 40 | # |
| 41 | # Media processing code is inherently risky and thus should have limited |
| 42 | # permissions and be isolated from the rest of the system and network. |
| 43 | # Lengthier explanation here: |
| 44 | # https://android-developers.googleblog.com/2016/05/hardening-media-stack.html |
Yifan Hong | 140072f | 2021-06-08 10:32:18 -0700 | [diff] [blame] | 45 | neverallow mediametrics domain:{ udp_socket rawip_socket } *; |
| 46 | neverallow mediametrics { domain userdebug_or_eng(`-su') }:tcp_socket *; |