From 8546ea34c6a29af81e1e91ccb6eb59429dd94d03 Mon Sep 17 00:00:00 2001 From: Simon MacMullen Date: Mon, 23 Jun 2025 11:52:14 +0000 Subject: [PATCH] Move CPU time in state bpf maps to their own dir, This will allow us to use a genfscon SELinux rule to get finer grained access control. Bug: 422976190 Test: Recorded a Perfetto trace with statsd atom CPU_CYCLES_PER_UID_CLUSTER, tested manually with go/atomtester. Change-Id: Ic16da605b9d7150d42176c428f0e1ecaf4a9472f --- loader/bpfloader.rs | 4 ++-- progs/include/bpf_timeinstate.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/loader/bpfloader.rs b/loader/bpfloader.rs index 6c73606..8cc64c7 100644 --- a/loader/bpfloader.rs +++ b/loader/bpfloader.rs @@ -215,8 +215,8 @@ const GID_MEDIA_RW: u32 = AID_MEDIA_RW; const FILE_ARR: &[BpfFileDesc] = &[ BpfFileDesc { filename: "timeInState.bpf", - dir: "/etc/bpf/", - prefix: "", + dir: "/etc/bpf/cputimeinstate/", + prefix: "cputimeinstate/", critical: false, skip_on_user: false, maps: &[ diff --git a/progs/include/bpf_timeinstate.h b/progs/include/bpf_timeinstate.h index 1065b6e..7840619 100644 --- a/progs/include/bpf_timeinstate.h +++ b/progs/include/bpf_timeinstate.h @@ -17,7 +17,7 @@ #include #include -#define BPF_FS_PATH "/sys/fs/bpf/" +#define BPF_TIMEINSTATE_PATH "/sys/fs/bpf/cputimeinstate/" // Number of frequencies tracked in the array with total time. If some CPUs have // more than 64 freqs