sepolicy : add bootkpi secontext and allow rule to access
Bootkpi marker are logged from different services and some
untrusted apps. Allowing them to with write access for logging
the bootkpi marker.
Change-Id: I3bfb52d611b4af52cf3c6032cca9f34874736a66
diff --git a/common/file.te b/common/file.te
index e3f1b3a..4dfe3ff 100644
--- a/common/file.te
+++ b/common/file.te
@@ -173,3 +173,6 @@
# qtitetherservice files
type qtitetherservice_app_data_file, file_type, data_file_type;
+
+# Boot KPI Marker files
+type sys_bootkpi, sysfs_type, file_type;
diff --git a/common/genfs_contexts b/common/genfs_contexts
index f92adbd..c3d58b5 100755
--- a/common/genfs_contexts
+++ b/common/genfs_contexts
@@ -1,2 +1,3 @@
genfscon proc /asound/card0/state u:object_r:proc_audiod:s0
genfscon proc /proc/sys/vm/dirty_ratio u:object_r:proc_dirty_ratio:s0
+genfscon sys /sys/bootkpi/marker_entry u:object_r:sys_bootkpi:s0
diff --git a/msm8960/bootkpi.te b/msm8960/bootkpi.te
new file mode 100644
index 0000000..e932e69
--- /dev/null
+++ b/msm8960/bootkpi.te
@@ -0,0 +1,36 @@
+# Copyright (c) 2015, 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.
+
+#Access to the marker_entry for logging KPI's
+userdebug_or_eng(`
+ allow zygote sys_bootkpi:file rw_file_perms;
+ allow mediaserver sys_bootkpi:file rw_file_perms;
+ allow system_server sys_bootkpi:file rw_file_perms;
+ allow surfaceflinger sys_bootkpi:file rw_file_perms;
+ allow untrusted_app sys_bootkpi:file rw_file_perms;
+ allow location sys_bootkpi:file rw_file_perms;
+')
diff --git a/msm8960/file_contexts b/msm8960/file_contexts
index 877f6bb..add8b81 100755
--- a/msm8960/file_contexts
+++ b/msm8960/file_contexts
@@ -29,3 +29,4 @@
# Data files
#
/data/qcks(/.*)? u:object_r:efs_data_file:s0
+/sys/bootkpi/marker_entry u:object_r:sys_bootkpi:s0