Shawn Shin | 9b5762b | 2017-05-04 22:49:13 -0700 | [diff] [blame] | 1 | # Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 2 | # |
| 3 | # Redistribution and use in source and binary forms, with or without |
| 4 | # modification, are permitted provided that the following conditions are |
| 5 | # met: |
| 6 | # * Redistributions of source code must retain the above copyright |
| 7 | # notice, this list of conditions and the following disclaimer. |
| 8 | # * Redistributions in binary form must reproduce the above |
| 9 | # copyright notice, this list of conditions and the following |
| 10 | # disclaimer in the documentation and/or other materials provided |
| 11 | # with the distribution. |
| 12 | # * Neither the name of The Linux Foundation nor the names of its |
| 13 | # contributors may be used to endorse or promote products derived |
| 14 | # from this software without specific prior written permission. |
| 15 | # |
| 16 | # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED |
| 17 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 18 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT |
| 19 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 20 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 22 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 26 | # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
Choong Lee | 0dbe2eb | 2017-07-19 12:22:04 -0700 | [diff] [blame] | 28 | type qdmastatsd, domain, mlstrustedsubject; |
Shawn Shin | 9b5762b | 2017-05-04 22:49:13 -0700 | [diff] [blame] | 29 | type qdmastatsd_exec, file_type, vendor_file_type, exec_type; |
| 30 | |
| 31 | init_daemon_domain(qdmastatsd) |
| 32 | |
| 33 | allow qdmastatsd qdma_data_file:file create_file_perms; |
| 34 | allow qdmastatsd qdma_data_file:dir create_dir_perms; |
| 35 | |
Shawn Shin | a61c1d7 | 2018-01-04 10:29:00 -0800 | [diff] [blame] | 36 | # access to /dev/ramdump_microdump_modem |
| 37 | allow qdmastatsd ramdump_device:chr_file r_file_perms; |
| 38 | |
Shawn Shin | 9b5762b | 2017-05-04 22:49:13 -0700 | [diff] [blame] | 39 | # access to /sys/class/power_supply/bms/charge_counter |
| 40 | # access to /sys/class/power_supply/battery/capacity |
| 41 | # access to /sys/class/power_supply/battery/status |
| 42 | allow qdmastatsd sysfs_battery_supply:{file lnk_file} r_file_perms; |
| 43 | allow qdmastatsd sysfs_battery_supply:dir r_dir_perms; |
| 44 | |
| 45 | # /sys/class/kgsl/kgsl-3d0/gpu_busy_percentage |
| 46 | # /sys/class/kgsl/kgsl-3d0/gpuclk |
| 47 | # /sys/class/kgsl/kgsl-3d0/gpu_clock_stats |
| 48 | # /sys/class/kgsl/kgsl-3d0/num_pwrlevels |
| 49 | # /sys/class/kgsl/kgsl-3d0/gpu_available_frequencies |
| 50 | allow qdmastatsd sysfs_kgsl:{file lnk_file} r_file_perms; |
| 51 | allow qdmastatsd sysfs_kgsl:dir r_dir_perms; |
| 52 | |
| 53 | # /sys/class/leds/lcd-backlight/brightness |
Choong Lee | a1eb7ca | 2017-07-10 12:10:34 -0700 | [diff] [blame] | 54 | allow qdmastatsd sysfs_leds:{file lnk_file} r_file_perms; |
| 55 | allow qdmastatsd sysfs_leds:dir r_dir_perms; |
Shawn Shin | 9b5762b | 2017-05-04 22:49:13 -0700 | [diff] [blame] | 56 | allow qdmastatsd sysfs_graphics:{file lnk_file} r_file_perms; |
| 57 | allow qdmastatsd sysfs_graphics:dir r_dir_perms; |
| 58 | |
| 59 | # access to /sys/devices/system/cpu/possible |
| 60 | allow qdmastatsd sysfs_devices_system_cpu:file r_file_perms; |
| 61 | allow qdmastatsd sysfs_devices_system_cpu:dir r_dir_perms; |
| 62 | |
| 63 | # access to /sys/module/lpm_stats/cpu%d/total_sleep_time_secs |
| 64 | #allow qdmastatsd sysfs_lpm_stats:{file lnk_file} r_file_perms; |
| 65 | #allow qdmastatsd sysfs_lpm_stats:dir r_dir_perms; |
| 66 | |
| 67 | # access to /sys/class/thermal/thermal_zone%d |
| 68 | allow qdmastatsd sysfs_thermal:{file lnk_file} r_file_perms; |
| 69 | allow qdmastatsd sysfs_thermal:dir r_dir_perms; |
| 70 | |
| 71 | # access to /sys/power/wake_lock, wake_unlock |
| 72 | allow qdmastatsd sysfs_wake_lock:file r_file_perms; |
| 73 | allow qdmastatsd sysfs_wake_lock:dir r_dir_perms; |
| 74 | |
| 75 | # access to /proc/stat |
| 76 | allow qdmastatsd proc_stat:file r_file_perms; |
| 77 | allow qdmastatsd proc_stat:dir r_dir_perms; |
| 78 | |
| 79 | # access to /proc/net/xt_qtaguid/stats |
| 80 | allow qdmastatsd proc_net:file r_file_perms; |
| 81 | allow qdmastatsd proc_net:dir r_dir_perms; |
| 82 | |
Choong Lee | 0dbe2eb | 2017-07-19 12:22:04 -0700 | [diff] [blame] | 83 | # access to /proc/<pid>/ |
| 84 | r_dir_file(qdmastatsd, domain); |
| 85 | |
| 86 | # qmi |
| 87 | qmux_socket(qdmastatsd); |
| 88 | allow qdmastatsd self:socket create_socket_perms; |
| 89 | allowxperm qdmastatsd self:socket ioctl msm_sock_ipc_ioctls; |
| 90 | |
Shawn Shini | 3d4536a | 2017-08-14 16:25:22 -0700 | [diff] [blame] | 91 | # diag |
| 92 | userdebug_or_eng(` |
| 93 | diag_use(qdmastatsd) |
| 94 | ') |
| 95 | |
Shawn Shin | 9b5762b | 2017-05-04 22:49:13 -0700 | [diff] [blame] | 96 | # for dmesg |
| 97 | #read_logd(qdmastatsd); |
Shawn Shin | a565628 | 2017-11-08 15:20:25 -0800 | [diff] [blame] | 98 | |
| 99 | # allow qdma_prop |
| 100 | set_prop(qdmastatsd, qdma_prop); |