diff options
| author | Kyle Zeng <kylebot@openai.com> | 2026-10-06 15:40:05 -0700 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2026-11-20 10:02:33 -0500 |
| commit | 9eb7e9068b26120b201e4b10237a5bbe5b95d855 (patch) | |
| tree | ef66524f0fa7c6a2eae579050b197a8818601f78 /rust/kernel/alloc | |
| parent | 09ee6ce0a9496b39cb8682101912e8f9291df61d (diff) | |
tracing: Restrict perf filters that read kernel strings
A task-bound, counting-only syscall tracepoint can be opened without
permission to read raw kernel tracepoint data. Setting exclude_kernel
does not prevent its filter from running: perf_syscall_enter() submits
the saved user-mode registers.
Pointer-string filters use FILTER_PRED_FN_PCHAR by default, which reads
through strncpy_from_kernel_nofault(). For sys_enter_openat, for example,
the filename field comes directly from a syscall argument. An
unprivileged caller can pass a kernel address, install a filter such as
'filename ~ "Linux version*"', and use the event count to test the
contents of kernel memory, even with perf_event_paranoid=2.
Check the compiled filter before installing it and require the same
kernel and raw-tracepoint permissions as access to raw kernel tracepoint
data for FILTER_PRED_FN_PCHAR. Inspect every predicate so that other
events, operators, and boolean expressions cannot bypass the check.
Return the permission error through the existing cleanup path before
publishing the filter.
Keep user-pointer (.ustring) and record-local predicates available under
the existing policy. This leaves tracefs filtering and authorized kernel
string filtering unchanged.
Link: https://patch.msgid.link/20261006224005.49636-1-kylebot@openai.com
Fixes: 5967bd5c4239 ("tracing: Let filter_assign_type() detect FILTER_PTR_STRING")
Assisted-by: Codex:gpt-6-astra
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'rust/kernel/alloc')
0 files changed, 0 insertions, 0 deletions
