From a1db36e1c098d44b0c9718634812f5c43e7b8759 Mon Sep 17 00:00:00 2001
From: Wei Wang <wvw@google.com>
Date: Thu, 5 Apr 2018 12:13:43 -0700
Subject: [PATCH] Allow dumpstate to kill dumpstate vendor HAL in timeout case

Bug: 77489941
Test: simulate delay in dumpstate HAL and get BR, see below from dumpstate_log.txt
    dumpstateBoard timed out after 10s, killing dumpstate vendor HAL
    dumpstateBoard failed: Status(EX_TRANSACTION_FAILED): 'DEAD_OBJECT: '
Change-Id: I90ed5cb8fe8da8ad21ae77676433936cb12d9d04
(cherry picked from commit 60d17674596c5fd58a60c67e23ab04d7d1426485)
---
 private/property_contexts | 1 +
 public/dumpstate.te       | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/private/property_contexts b/private/property_contexts
index de09d4a60..1b2743284 100644
--- a/private/property_contexts
+++ b/private/property_contexts
@@ -95,6 +95,7 @@ ro.persistent_properties.ready  u:object_r:persistent_properties_ready_prop:s0
 
 # ctl properties
 ctl.bootanim            u:object_r:ctl_bootanim_prop:s0
+ctl.android.hardware.dumpstate u:object_r:ctl_dumpstate_prop:s0
 ctl.dumpstate           u:object_r:ctl_dumpstate_prop:s0
 ctl.fuse_               u:object_r:ctl_fuse_prop:s0
 ctl.mdnsd               u:object_r:ctl_mdnsd_prop:s0
diff --git a/public/dumpstate.te b/public/dumpstate.te
index 62762d3e5..0269ce14c 100644
--- a/public/dumpstate.te
+++ b/public/dumpstate.te
@@ -267,6 +267,9 @@ allow dumpstate self:netlink_socket create_socket_perms_no_ioctl;
 # newer kernels (e.g. 4.4) have a new class for sockets
 allow dumpstate self:netlink_generic_socket create_socket_perms_no_ioctl;
 
+# Allow dumpstate to kill vendor dumpstate service by init
+set_prop(dumpstate, ctl_dumpstate_prop)
+
 ###
 ### neverallow rules
 ###
-- 
GitLab