From 96031a8357d96f2b260e65476bdec67c6424671b Mon Sep 17 00:00:00 2001
From: Iliyan Malchev <malchev@google.com>
Date: Mon, 19 Sep 2016 15:23:41 -0700
Subject: [PATCH] sepolicy: allow hwservicemanager to set properties

Allow hwservicemanager to set properties starting with the prefix
"hwservicemanager."

b/31458381
b/31240290
Test: passing build and runtime tests

Change-Id: Id92e2170f52893bbf236987ee59383df2264952f
Signed-off-by: Iliyan Malchev <malchev@google.com>
---
 hwservicemanager.te | 2 ++
 property.te         | 1 +
 property_contexts   | 3 +++
 3 files changed, 6 insertions(+)

diff --git a/hwservicemanager.te b/hwservicemanager.te
index c3477556b..649e2b8f6 100644
--- a/hwservicemanager.te
+++ b/hwservicemanager.te
@@ -13,6 +13,8 @@ init_daemon_domain(hwservicemanager)
 allow hwservicemanager self:binder set_context_mgr;
 allow hwservicemanager { domain -init }:binder transfer;
 
+set_prop(hwservicemanager, hwservicemanager_prop)
+
 # TODO once hwservicemanager checks whether HALs are
 # allowed to register a certain service, add policy here
 # for allowing to check SELinux permissions.
diff --git a/property.te b/property.te
index 2c2ddcce8..379320fd1 100644
--- a/property.te
+++ b/property.te
@@ -40,5 +40,6 @@ type dalvik_prop, property_type, core_property_type;
 type config_prop, property_type, core_property_type;
 type device_logging_prop, property_type;
 type safemode_prop, property_type;
+type hwservicemanager_prop, property_type;
 
 allow property_type tmpfs:filesystem associate;
diff --git a/property_contexts b/property_contexts
index 34191db45..df8222313 100644
--- a/property_contexts
+++ b/property_contexts
@@ -99,3 +99,6 @@ ro.dalvik.              u:object_r:dalvik_prop:s0
 
 # Shared between system server and wificond
 wlan.                   u:object_r:wifi_prop:s0
+
+# hwservicemanager properties
+hwservicemanager.       u:object_r:hwservicemanager_prop:s0
-- 
GitLab