From 985bbf7e34489068989dfaf63a7be3f001a9067b Mon Sep 17 00:00:00 2001 From: Mohammed Mirza Mandayappurath Manzoor Date: Thu, 10 Feb 2022 14:55:07 -0800 Subject: [PATCH] sepolicy_vndr: Add shell permission to /sys/class/kgsl/kgsl-3d0/perfcounter Allow shell users to have permission to update sysfs node /sys/class/kgsl/kgsl-3d0/perfcounter Change-Id: I648b7f4b25e4c8c1644be5046677f41e7b5d2f8c --- generic/vendor/common/file.te | 1 + generic/vendor/common/genfs_contexts | 2 ++ generic/vendor/common/shell.te | 3 +++ 3 files changed, 6 insertions(+) diff --git a/generic/vendor/common/file.te b/generic/vendor/common/file.te index 5990b803..849ba9a1 100644 --- a/generic/vendor/common/file.te +++ b/generic/vendor/common/file.te @@ -42,6 +42,7 @@ type vendor_sysfs_graphics, sysfs_type, fs_type; type vendor_sysfs_sd, sysfs_type, fs_type; type vendor_sysfs_kgsl, sysfs_type, fs_type; type vendor_sysfs_kgsl_proc, sysfs_type, fs_type; +type vendor_sysfs_kgsl_shell, sysfs_type, fs_type; type vendor_hbtp_kernel_sysfs, sysfs_type, fs_type; type vendor_sysfs_irqbalance, sysfs_type, fs_type; type vendor_sysfs_laser, sysfs_type, fs_type; diff --git a/generic/vendor/common/genfs_contexts b/generic/vendor/common/genfs_contexts index ede62402..dcfa444e 100644 --- a/generic/vendor/common/genfs_contexts +++ b/generic/vendor/common/genfs_contexts @@ -121,6 +121,8 @@ genfscon sysfs /devices/virtual/workqueue/kgsl-events/nice u genfscon sysfs /devices/virtual/workqueue/kgsl-workqueue/cpumask u:object_r:vendor_sysfs_kgsl:s0 genfscon sysfs /devices/virtual/workqueue/kgsl-workqueue/nice u:object_r:vendor_sysfs_kgsl:s0 +genfscon sysfs /class/kgsl/kgsl-3d0/perfcounter u:object_r:vendor_sysfs_kgsl_shell:s0 + genfscon sysfs /module/drm/parameters/vblankoffdelay u:object_r:vendor_sysfs_graphics:s0 genfscon sysfs /class/sensors u:object_r:vendor_sysfs_sensors:s0 diff --git a/generic/vendor/common/shell.te b/generic/vendor/common/shell.te index 3c9932a5..0d6a3f20 100644 --- a/generic/vendor/common/shell.te +++ b/generic/vendor/common/shell.te @@ -34,3 +34,6 @@ userdebug_or_eng(` allow shell vendor_debugfs_kgsl_fence_tracing:file r_file_perms; allow shell vendor_debugfs_kgsl_fence_tracing:dir r_dir_perms; ') + +# allow shell users to control kgsl perfcounters +allow shell vendor_sysfs_kgsl_shell:file rw_file_perms;