sepolicy: Add permission for hang_guard
Allow sepolicy rules for hang_guard to send signal to process, write into kmsg, look through proc and write into sysrq. Change-Id: Ia707097a5e4867377138df7948f50441f560bdd6
This commit is contained in:
parent
7d18f09cb6
commit
0c5dfc296b
4 changed files with 108 additions and 0 deletions
3
generic/vendor/test/file_contexts
vendored
3
generic/vendor/test/file_contexts
vendored
|
@ -77,6 +77,9 @@
|
|||
/(vendor|system/vendor)/bin/test-fake-ap u:object_r:vendor_location_exec:s0
|
||||
/(vendor|system/vendor)/bin/test-fdal u:object_r:vendor_location_exec:s0
|
||||
|
||||
#### Context for hang_guard
|
||||
/(vendor|system/vendor)/bin/hang_guard u:object_r:vendor_hang_guard_exec:s0
|
||||
|
||||
#For debug script
|
||||
/(vendor|system/vendor)/bin/init\.qti\.kernel\.debug\.sh u:object_r:vendor_qti_init_shell_exec:s0
|
||||
|
||||
|
|
51
generic/vendor/test/hang_guard.te
vendored
Normal file
51
generic/vendor/test/hang_guard.te
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
type vendor_hang_guard, domain, mlstrustedsubject;
|
||||
type vendor_hang_guard_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(vendor_hang_guard)
|
||||
|
||||
userdebug_or_eng(`
|
||||
allow vendor_hang_guard self:global_capability_class_set kill;
|
||||
allow vendor_hang_guard kmsg_device:chr_file w_file_perms;
|
||||
allow vendor_hang_guard domain:process { signal sigstop sigkill };
|
||||
|
||||
# sh
|
||||
allow vendor_hang_guard { vendor_shell_exec vendor_toolbox_exec }:file rx_file_perms;
|
||||
|
||||
# look through /proc
|
||||
allow vendor_hang_guard domain:dir r_dir_perms;
|
||||
allow vendor_hang_guard domain:file r_file_perms;
|
||||
allow vendor_hang_guard domain:lnk_file read;
|
||||
|
||||
# write into sysrq
|
||||
allow vendor_hang_guard proc_sysrq:file w_file_perms;
|
||||
|
||||
# reboot
|
||||
set_prop(vendor_hang_guard, powerctl_prop)
|
||||
')
|
3
legacy/vendor/test/file_contexts
vendored
3
legacy/vendor/test/file_contexts
vendored
|
@ -93,6 +93,9 @@
|
|||
/(vendor|system/vendor)/bin/loc_api_app u:object_r:location_exec:s0
|
||||
/(vendor|system/vendor)/bin/test_loc_api_client u:object_r:location_exec:s0
|
||||
|
||||
#Context for hang_guard
|
||||
/(vendor|system/vendor)/bin/hang_guard u:object_r:hang_guard_exec:s0
|
||||
|
||||
/(vendor|system/vendor)/bin/sns.* u:object_r:sensors_test_exec:s0
|
||||
#for testscripts support
|
||||
/(vendor|system/vendor)/bin/init\.qcom\.vendor\.testscripts\.sh u:object_r:vendor-qti-testscripts_exec:s0
|
||||
|
|
51
legacy/vendor/test/hang_guard.te
vendored
Normal file
51
legacy/vendor/test/hang_guard.te
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of The Linux Foundation nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
type hang_guard, domain, mlstrustedsubject;
|
||||
type hang_guard_exec, exec_type, vendor_file_type, file_type;
|
||||
|
||||
init_daemon_domain(hang_guard)
|
||||
|
||||
userdebug_or_eng(`
|
||||
allow hang_guard self:global_capability_class_set kill;
|
||||
allow hang_guard kmsg_device:chr_file w_file_perms;
|
||||
allow hang_guard domain:process { signal sigstop sigkill };
|
||||
|
||||
# sh
|
||||
# allow hang_guard { shell_exec toolbox_exec }:file rx_file_perms;
|
||||
|
||||
# look through /proc
|
||||
allow hang_guard domain:dir r_dir_perms;
|
||||
allow hang_guard domain:file r_file_perms;
|
||||
allow hang_guard domain:lnk_file read;
|
||||
|
||||
# write into sysrq
|
||||
allow hang_guard proc_sysrq:file w_file_perms;
|
||||
|
||||
# reboot
|
||||
set_prop(hang_guard, powerctl_prop)
|
||||
')
|
Loading…
Reference in a new issue