From 4802cbd955648d3fe5d1a82e7ae6eec13c829b33 Mon Sep 17 00:00:00 2001
From: Hector Dearman <hjd@google.com>
Date: Thu, 6 Dec 2018 18:32:23 +0000
Subject: [PATCH] traced_probes: Read tracefs directories in userdebug

Allow traced_probes to read /sys/kernel/debug/tracing
directories in userdebug mode. We read the directory when enabling
events with the wild card syntax: "oom/*" which attmpts to read the
directory /sys/kernel/debug/tracing/events/oom to work out what oom
events exist.

Denial:
  avc: denied { read } for name="oom" dev="tracefs" ino=11353
  scontext=u:r:traced_probes:s0
  tcontext=u:object_r:debugfs_tracing_debug:s0 tclass=dir
  permissive=0

Bug: 119662403
Test: perfetto -t 10s 'oom/*' -o /data/misc/perfetto-traces/trace
Change-Id: I2cb171c3c5292d2eb55e71376f965b924a563572
---
 private/traced_probes.te | 1 +
 1 file changed, 1 insertion(+)

diff --git a/private/traced_probes.te b/private/traced_probes.te
index b0b87d849..ad6611c94 100644
--- a/private/traced_probes.te
+++ b/private/traced_probes.te
@@ -18,6 +18,7 @@ allow traced_probes debugfs_trace_marker:file getattr;
 # TODO(primiano): temporarily I/O tracing categories are still
 # userdebug only until we nail down the blacklist/whitelist.
 userdebug_or_eng(`
+allow traced_probes debugfs_tracing_debug:dir r_dir_perms;
 allow traced_probes debugfs_tracing_debug:file rw_file_perms;
 ')
 
-- 
GitLab