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
This commit is contained in:
Hareesh Gundu
2017-08-13 22:42:00 +05:30
committed by Gerrit - the friendly Code Review server
parent e6fe86a3b9
commit 96af83ae09
3 changed files with 43 additions and 1 deletions

35
test/domain.te Normal file
View File

@@ -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;
')

View File

@@ -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;

View File

@@ -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