2018-08-22 08:59:46 +02:00
|
|
|
type statsd, domain, mlstrustedsubject;
|
|
|
|
|
2018-09-27 19:21:37 +02:00
|
|
|
type statsd_exec, system_file_type, exec_type, file_type;
|
2018-08-22 08:59:46 +02:00
|
|
|
binder_use(statsd)
|
|
|
|
|
|
|
|
# Allow statsd to scan through /proc/pid for all processes.
|
|
|
|
r_dir_file(statsd, domain)
|
|
|
|
|
|
|
|
# Allow executing files on system, such as running a shell or running:
|
|
|
|
# /system/bin/toolbox
|
|
|
|
# /system/bin/logcat
|
|
|
|
# /system/bin/dumpsys
|
|
|
|
allow statsd devpts:chr_file { getattr ioctl read write };
|
|
|
|
allow statsd shell_exec:file rx_file_perms;
|
|
|
|
allow statsd system_file:file execute_no_trans;
|
|
|
|
allow statsd toolbox_exec:file rx_file_perms;
|
|
|
|
|
|
|
|
userdebug_or_eng(`
|
|
|
|
allow statsd su:fifo_file read;
|
|
|
|
')
|
|
|
|
|
2023-02-02 20:57:18 +01:00
|
|
|
# Create, read, and write into
|
|
|
|
# /data/misc/stats-active-metric
|
|
|
|
# /data/misc/stats-data
|
|
|
|
# /data/misc/stats-metadata
|
|
|
|
# /data/misc/stats-service
|
|
|
|
# /data/misc/train-info
|
2018-08-22 08:59:46 +02:00
|
|
|
allow statsd stats_data_file:dir create_dir_perms;
|
|
|
|
allow statsd stats_data_file:file create_file_perms;
|
2023-02-02 20:57:18 +01:00
|
|
|
allow statsd stats_config_data_file:dir create_dir_perms;
|
|
|
|
allow statsd stats_config_data_file:file create_file_perms;
|
2018-08-22 08:59:46 +02:00
|
|
|
|
|
|
|
# Allow statsd to make binder calls to any binder service.
|
|
|
|
binder_call(statsd, appdomain)
|
|
|
|
binder_call(statsd, incidentd)
|
|
|
|
binder_call(statsd, system_server)
|
2023-03-22 09:14:38 +01:00
|
|
|
binder_call(statsd, traced_probes)
|
2019-03-02 02:51:12 +01:00
|
|
|
|
|
|
|
# Allow statsd to interact with gpuservice
|
|
|
|
allow statsd gpu_service:service_manager find;
|
2019-02-25 10:10:49 +01:00
|
|
|
binder_call(statsd, gpuservice)
|
2018-08-22 08:59:46 +02:00
|
|
|
|
2021-04-12 23:27:12 +02:00
|
|
|
# Allow statsd to interact with keystore to pull atoms
|
|
|
|
allow statsd keystore_service:service_manager find;
|
|
|
|
binder_call(statsd, keystore)
|
|
|
|
|
2021-03-12 12:57:38 +01:00
|
|
|
# Allow statsd to interact with mediametrics
|
|
|
|
allow statsd mediametrics_service:service_manager find;
|
|
|
|
binder_call(statsd, mediametrics)
|
|
|
|
|
2023-01-24 01:38:43 +01:00
|
|
|
# Allow statsd to interact with mediametrics
|
|
|
|
allow statsd mediaserver_service:service_manager find;
|
|
|
|
binder_call(statsd, mediaserver)
|
|
|
|
|
2018-08-22 08:59:46 +02:00
|
|
|
# Allow logd access.
|
|
|
|
read_logd(statsd)
|
|
|
|
control_logd(statsd)
|
|
|
|
|
|
|
|
# Grant statsd with permissions to register the services.
|
|
|
|
allow statsd {
|
|
|
|
app_api_service
|
|
|
|
incident_service
|
|
|
|
system_api_service
|
|
|
|
}:service_manager find;
|
|
|
|
|
|
|
|
# Grant statsd to access health hal to access battery metrics.
|
|
|
|
allow statsd hal_health_hwservice:hwservice_manager find;
|
|
|
|
|
|
|
|
# Allow statsd to send dump info to dumpstate
|
|
|
|
allow statsd dumpstate:fd use;
|
|
|
|
allow statsd dumpstate:fifo_file { getattr write };
|
|
|
|
|
|
|
|
# Allow access to with hardware layer and process stats.
|
|
|
|
allow statsd proc_uid_cputime_showstat:file { getattr open read };
|
|
|
|
hal_client_domain(statsd, hal_health)
|
|
|
|
hal_client_domain(statsd, hal_power)
|
2018-12-10 23:59:57 +01:00
|
|
|
hal_client_domain(statsd, hal_power_stats)
|
2018-08-22 08:59:46 +02:00
|
|
|
hal_client_domain(statsd, hal_thermal)
|
|
|
|
|
|
|
|
# Allow 'adb shell cmd' to upload configs and download output.
|
|
|
|
allow statsd adbd:fd use;
|
|
|
|
allow statsd adbd:unix_stream_socket { getattr read write };
|
2018-12-19 00:56:29 +01:00
|
|
|
allow statsd shell:fifo_file { getattr read write };
|
2018-08-22 08:59:46 +02:00
|
|
|
|
|
|
|
unix_socket_send(statsd, statsdw, statsd)
|
|
|
|
|
|
|
|
###
|
|
|
|
### neverallow rules
|
|
|
|
###
|
|
|
|
|
|
|
|
# Only statsd and the other root services in limited circumstances.
|
|
|
|
# can get to the files in /data/misc/stats-data, /data/misc/stats-service.
|
|
|
|
# Other services are prohibitted from accessing the file.
|
2023-02-02 20:57:18 +01:00
|
|
|
neverallow { domain -statsd -init -vold } stats_data_file:file *;
|
|
|
|
neverallow { domain -statsd -system_server -init -vold } stats_config_data_file:file *;
|
|
|
|
|
2018-08-22 08:59:46 +02:00
|
|
|
|
|
|
|
# Limited access to the directory itself.
|
2023-02-02 20:57:18 +01:00
|
|
|
neverallow { domain -statsd -init -vold } stats_data_file:dir *;
|
|
|
|
neverallow { domain -statsd -system_server -init -vold } stats_config_data_file:dir *;
|