From bdf0a56bf341ccbb49573058db8671b54579f42e Mon Sep 17 00:00:00 2001 From: Ryan Savitski Date: Sun, 25 Feb 2024 18:45:20 +0000 Subject: [PATCH] tracefs: allow using "/sys/kernel/tracing/buffer_percent" on release devices This is a tracing control file that userspace can read/write an ascii number (e.g. "50"). In turn, it controls the behaviour of blocking read(), splice(), and poll() on the tracing kernel ring buffer fds. A blocked syscall will only be woken up once the kernel fills the buffer past the "buffer_percent" watermark (so 50% -> half-full). We'll be using this file in perfetto's traced_probes, but it should also be safe to expose to other users of the tracing file system (aka debugfs_tracing in sepolicy) on release builds. Added to linux in: https://android.googlesource.com/kernel/common/+/03329f99 Change-Id: Ifcdc73cb0162e8cdadf2e7c16b0215410134ccae --- private/genfs_contexts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/private/genfs_contexts b/private/genfs_contexts index e4baeeeda..ae26059eb 100644 --- a/private/genfs_contexts +++ b/private/genfs_contexts @@ -252,6 +252,7 @@ genfscon tracefs /events/synthetic/suspend_resume_minimal u:objec genfscon debugfs /tracing/events/synthetic/suspend_resume_minimal u:object_r:debugfs_tracing:s0 genfscon tracefs /trace_clock u:object_r:debugfs_tracing:s0 +genfscon tracefs /buffer_percent u:object_r:debugfs_tracing:s0 genfscon tracefs /buffer_size_kb u:object_r:debugfs_tracing:s0 genfscon tracefs /options/overwrite u:object_r:debugfs_tracing:s0 genfscon tracefs /options/print-tgid u:object_r:debugfs_tracing:s0 @@ -319,6 +320,7 @@ genfscon tracefs /events/clk/clk_disable/ u:objec genfscon tracefs /events/clk/clk_set_rate/ u:object_r:debugfs_tracing:s0 genfscon debugfs /tracing/trace_clock u:object_r:debugfs_tracing:s0 +genfscon debugfs /tracing/buffer_percent u:object_r:debugfs_tracing:s0 genfscon debugfs /tracing/buffer_size_kb u:object_r:debugfs_tracing:s0 genfscon debugfs /tracing/options/overwrite u:object_r:debugfs_tracing:s0 genfscon debugfs /tracing/options/print-tgid u:object_r:debugfs_tracing:s0