summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHareesh Gundu <hareeshg@codeaurora.org>2017-08-13 22:42:00 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2017-08-29 03:56:31 -0700
commit96af83ae09c04cd2cd0482ec01f4c078112f14d4 (patch)
tree1ab9a2113c962a8d343f91a6554344a165ad85f0
parente6fe86a3b9ef35541a09447b6abb614f4cee32d5 (diff)
downloadandroid_device_qcom_sepolicy-legacy-96af83ae09c04cd2cd0482ec01f4c078112f14d4.tar.gz
android_device_qcom_sepolicy-legacy-96af83ae09c04cd2cd0482ec01f4c078112f14d4.tar.bz2
android_device_qcom_sepolicy-legacy-96af83ae09c04cd2cd0482ec01f4c078112f14d4.zip
sepolicy: Add a rule to access gpu configuration settings
For all GPU application needs access to /data/vendor/gpu path to configure the graphics user mode driver. Also it need access to sysfs kgsl snapshot path for getting the gpu snapshot dump and timestamp information. Also Addressing following denials : comm.adrenotest: type=1400 audit(0.0:204): avc: denied { open } for path="/data/misc/gpu/esx_config.txt" dev="dm-0" ino=148200 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0 comm.adrenotest: type=1400 audit(0.0:205): avc: denied { open } for path="/data/misc/gpu/adreno_config.txt" dev="dm-0" ino=148213 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:system_data_file:s0 tclass=file permissive=0 comm.adrenotest: type=1400 audit(0.0:175): avc: denied { search } for name="kgsl-3d0" dev="sysfs" ino=35267 scontext=u:r:untrusted_app_25:s0:c512,c768 tcontext=u:object_r:sysfs_kgsl:s0 tclass=dir permissive=0 CRs-Fixed: 2081160 Change-Id: Iee9cf0a9cad71856db12c31f80b1a87b79ddd42f
-rw-r--r--test/domain.te35
-rw-r--r--test/file.te5
-rwxr-xr-xtest/file_contexts4
3 files changed, 43 insertions, 1 deletions
diff --git a/test/domain.te b/test/domain.te
new file mode 100644
index 0000000..a2724d6
--- /dev/null
+++ b/test/domain.te
@@ -0,0 +1,35 @@
+# Copyright (c) 2017, 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.
+
+#allow all gpu clients to access configuration settings
+userdebug_or_eng(`
+allow domain sysfs_kgsl:dir search;
+r_dir_file(domain, sysfs_kgsl_snapshot);
+allow domain coredump_file:dir create_dir_perms;
+allow domain coredump_file:file create_file_perms;
+allow domain coredump_file:dir rw_dir_perms;
+')
diff --git a/test/file.te b/test/file.te
index 4b8b67d..359bb71 100644
--- a/test/file.te
+++ b/test/file.te
@@ -1,3 +1,6 @@
#Define the files written during the operation of mm-pp-daemon
type display_test_media_file, file_type, data_file_type;
-
+# kgsl snapshot file type for sysfs access
+type sysfs_kgsl_snapshot, sysfs_type, fs_type;
+# To allow GPU application to write "/data/vendor/gpu" path
+typeattribute coredump_file mlstrustedobject;
diff --git a/test/file_contexts b/test/file_contexts
index 29912b4..0508e72 100755
--- a/test/file_contexts
+++ b/test/file_contexts
@@ -68,3 +68,7 @@
#Context for mediaserver
/data/display-tests/media(/.*)? u:object_r:display_test_media_file:s0
+
+#Context for GPU applications
+/data/vendor/gpu(/.*)? u:object_r:coredump_file:s0
+/sys/devices(/platform)?/soc/[a-f0-9]+.qcom,kgsl-3d0/kgsl/kgsl-3d0/snapshot(/.*)? u:object_r:sysfs_kgsl_snapshot:s0