Storaged permission setting
Allowing storaged for reading from pseudo filesystems and debugfs.
Bug: 32221677
Change-Id: I837cead9a68f0b399703b64d724cb9c4b205c335
diff --git a/private/file_contexts b/private/file_contexts
index f6399fb..80e1927 100644
--- a/private/file_contexts
+++ b/private/file_contexts
@@ -227,6 +227,7 @@
/system/bin/idmap u:object_r:idmap_exec:s0
/system/bin/update_engine u:object_r:update_engine_exec:s0
/system/bin/bspatch u:object_r:update_engine_exec:s0
+/system/bin/storaged u:object_r:storaged_exec:s0
/system/bin/webview_zygote32 u:object_r:webview_zygote_exec:s0
/system/bin/webview_zygote64 u:object_r:webview_zygote_exec:s0
/system/fake-lib(64)?/libart.* u:object_r:libart_file:s0
@@ -422,6 +423,7 @@
#############################
# debugfs files
#
+/sys/kernel/debug/mmc0(/.*)? u:object_r:debugfs_mmc:s0
/sys/kernel/debug/tracing(/.*)? u:object_r:debugfs_tracing:s0
/sys/kernel/debug/tracing/trace_marker u:object_r:debugfs_trace_marker:s0
diff --git a/private/storaged.te b/private/storaged.te
new file mode 100644
index 0000000..e9a959c
--- /dev/null
+++ b/private/storaged.te
@@ -0,0 +1,19 @@
+# storaged daemon
+type storaged, domain;
+type storaged_exec, exec_type, file_type;
+
+init_daemon_domain(storaged)
+
+# Write to /dev/kmsg (opened in init)
+allow storaged kmsg_device:chr_file { write append };
+
+# Read access to pseudo filesystems
+allow storaged proc:dir r_dir_perms;
+r_dir_file(storaged, sysfs_type)
+r_dir_file(storaged, proc_net)
+
+# Read access to debugfs
+allow storaged debugfs_mmc:dir search;
+allow storaged debugfs_mmc:file r_file_perms;
+
+
diff --git a/public/file.te b/public/file.te
index 6184eef..0365dc9 100644
--- a/public/file.te
+++ b/public/file.te
@@ -57,6 +57,7 @@
type sdcardfs, sdcard_type, fs_type, mlstrustedobject;
type vfat, sdcard_type, fs_type, mlstrustedobject;
type debugfs, fs_type;
+type debugfs_mmc, fs_type, debugfs_type;
type debugfs_trace_marker, fs_type, debugfs_type, mlstrustedobject;
type debugfs_tracing, fs_type, debugfs_type;
type pstorefs, fs_type;