New sepolicy for perfprofd, simpleperf.

Bug: http://b/19483574

Change-Id: I594f04004cccd2cbfadbd0f9d1bbb9815a2ea59d
This commit is contained in:
Than McIntosh 2015-04-30 15:27:36 -04:00
parent 4a12d9630a
commit 0fdd364e89
2 changed files with 47 additions and 0 deletions

View file

@ -159,6 +159,8 @@
/system/bin/racoon u:object_r:racoon_exec:s0
/system/xbin/su u:object_r:su_exec:s0
/system/xbin/procrank u:object_r:procrank_exec:s0
/system/xbin/perfprofd u:object_r:perfprofd_exec:s0
/system/xbin/simpleperf u:object_r:system_file:s0
/system/vendor/bin/gpsd u:object_r:gpsd_exec:s0
/system/bin/dnsmasq u:object_r:dnsmasq_exec:s0
/system/bin/hostapd u:object_r:hostapd_exec:s0

45
perfprofd.te Normal file
View file

@ -0,0 +1,45 @@
# perfprofd - perf profile collection daemon
type perfprofd_exec, exec_type, file_type;
userdebug_or_eng(`
type perfprofd, domain, mlstrustedsubject;
init_daemon_domain(perfprofd)
# perfprofd needs to control CPU hot-plug in order to avoid kernel
# perfevents problems in cases where CPU goes on/off during measurement;
# this means read access to /sys/devices/system/cpu/possible
# and read/write access to /sys/devices/system/cpu/cpu*/online
allow perfprofd sysfs_devices_system_cpu:file rw_file_perms;
# perfprofd checks for the existence of and then invokes simpleperf;
# simpleperf retains perfprofd domain after exec
allow perfprofd system_file:file rx_file_perms;
# perfprofd reads a config file from /data/data/com.google.android.gms/files
# opens a file for writing in the same directory
allow perfprofd app_data_file:file rw_file_perms;
allow perfprofd app_data_file:dir rw_dir_perms;
# perfprofd looks for the existence of a semaphore file to determine
# whether collection is enabled/disabled (where the semphore file is
# created by some other entity, e.g. gms)
allow perfprofd app_data_file:dir search;
allow perfprofd self:capability { dac_override };
# perfprofd reads profiles from /data/data/..., encodes them,
# and then dumps the encoded profiles back to /data/data/....
allow perfprofd app_data_file:dir_file_class_set create_file_perms;
# perfprofd uses the system log
read_logd(perfprofd);
write_logd(perfprofd);
# simpleperf uses ioctl() to turn on kernel perf events measurements
allow perfprofd self:capability sys_admin;
# simpleperf is going to execute "sleep"
allow perfprofd toolbox_exec:file x_file_perms;
')