Sepolicy for mm_events

Allow mm_events to periodically arm the mm_events
perfetto trace config if mm_events is enabled.

Bug: 183037386
Test: boot; setprop persist.mm_events.enabled true; No avc denials
Change-Id: Ia9760001e7fb591f18e3e816a63281167a658c74
This commit is contained in:
Kalesh Singh 2021-03-16 14:30:36 -04:00
parent 0b4677c566
commit 326fc27064
7 changed files with 32 additions and 3 deletions

View file

@ -73,6 +73,7 @@
mediatuner
mediatranscoding_tmpfs
memtrackproxy_service
mm_events_config_prop
music_recognition_service
nfc_logs_data_file
odrefresh

View file

@ -489,3 +489,12 @@ neverallow domain mlsvendorcompat:process fork;
# Only init and otapreopt_chroot should be mounting filesystems on locations
# labeled system or vendor (/product and /vendor respectively).
neverallow { domain -init -otapreopt_chroot } { system_file_type vendor_file_type }:dir_file_class_set mounton;
# Only allow init and vendor_init to read/write mm_events properties
# NOTE: dumpstate is allowed to read any system property
neverallow {
domain
-init
-vendor_init
-dumpstate
} mm_events_config_prop:file no_rw_file_perms;

View file

@ -207,6 +207,7 @@
/system/apex/com.android.art u:object_r:art_apex_dir:s0
/system/lib(64)?(/.*)? u:object_r:system_lib_file:s0
/system/lib(64)?/bootstrap(/.*)? u:object_r:system_bootstrap_lib_file:s0
/system/bin/mm_events u:object_r:mm_events_exec:s0
/system/bin/atrace u:object_r:atrace_exec:s0
/system/bin/auditctl u:object_r:auditctl_exec:s0
/system/bin/bcc u:object_r:rs_exec:s0

14
private/mm_events.te Normal file
View file

@ -0,0 +1,14 @@
type mm_events, domain, coredomain;
type mm_events_exec, system_file_type, exec_type, file_type;
init_daemon_domain(mm_events)
allow mm_events shell_exec:file rx_file_perms;
# Allow running the sleep command to rate limit attempts
# to arm mm_events on failure.
allow mm_events toolbox_exec:file rx_file_perms;
allow mm_events perfetto_exec:file rx_file_perms;
domain_auto_trans(mm_events, perfetto_exec, perfetto)

View file

@ -29,11 +29,11 @@ allow perfetto dropbox_service:service_manager find;
allow perfetto perfetto_configs_data_file:dir r_dir_perms;
allow perfetto perfetto_configs_data_file:file r_file_perms;
# Allow perfetto to read the trace config from statsd and shell
# Allow perfetto to read the trace config from statsd, mm_events and shell
# (both root and non-root) on stdin and also to write the resulting trace to
# stdout.
allow perfetto { statsd shell su }:fd use;
allow perfetto { statsd shell su }:fifo_file { getattr read write };
allow perfetto { statsd mm_events shell su }:fd use;
allow perfetto { statsd mm_events shell su }:fifo_file { getattr read write };
# Allow to communicate use, read and write over the adb connection.
allow perfetto adbd:fd use;

View file

@ -241,6 +241,9 @@ persist.device_config.storage_native_boot. u:object_r:device_config_sto
persist.device_config.swcodec_native. u:object_r:device_config_swcodec_native_prop:s0
persist.device_config.window_manager_native_boot. u:object_r:device_config_window_manager_native_boot_prop:s0
# MM Events config props
persist.mm_events.enabled u:object_r:mm_events_config_prop:s0 exact bool
# Properties that relate to legacy server configurable flags
persist.device_config.global_settings.sys_traced u:object_r:device_config_sys_traced_prop:s0

View file

@ -141,6 +141,7 @@ system_vendor_config_prop(lmkd_config_prop)
system_vendor_config_prop(media_config_prop)
system_vendor_config_prop(media_variant_prop)
system_vendor_config_prop(mediadrm_config_prop)
system_vendor_config_prop(mm_events_config_prop)
system_vendor_config_prop(oem_unlock_prop)
system_vendor_config_prop(packagemanager_config_prop)
system_vendor_config_prop(recovery_config_prop)