From bb2591e56f0b88570e8bed0008b932bf7c51f533 Mon Sep 17 00:00:00 2001
From: Geremy Condra <gcondra@google.com>
Date: Thu, 4 Apr 2013 13:39:17 -0700
Subject: [PATCH] Add the sysrq_file special file and give ADB write access.

Change-Id: Ief2d412dddf4cefdf43a26538c4be060df4cc787
---
 adbd.te       | 3 +++
 file.te       | 2 ++
 file_contexts | 3 +++
 3 files changed, 8 insertions(+)

diff --git a/adbd.te b/adbd.te
index 4026fcb94..a92338fe6 100644
--- a/adbd.te
+++ b/adbd.te
@@ -35,3 +35,6 @@ allow adbd shell:process noatsecure;
 # XXX Run screencap in a separate domain?
 binder_use(adbd)
 binder_call(adbd, surfaceflinger)
+
+# Write to the sysrq file
+allow adbd sysrq_file:file w_file_perms;
diff --git a/file.te b/file.te
index 29b21061c..06ceeccd4 100644
--- a/file.te
+++ b/file.te
@@ -81,6 +81,8 @@ type security_file, file_type;
 type bluetooth_efs_file, file_type;
 # Downloaded files
 type download_file, file_type;
+# The sysrq special file
+type sysrq_file, file_type;
 
 # Socket types
 type adbd_socket, file_type;
diff --git a/file_contexts b/file_contexts
index 3d885b112..8906e389e 100644
--- a/file_contexts
+++ b/file_contexts
@@ -211,3 +211,6 @@
 # asec containers
 /mnt/asec(/.*)?         u:object_r:asec_apk_file:s0
 /data/app-asec(/.*)?    u:object_r:asec_image_file:s0
+#############################
+# special /proc files
+/proc/sysrq-trigger  u:object_r:sysrq_file:s0
-- 
GitLab