mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 12:44:03 +02:00
perf/core: Check kernel access when kernel callchains are requested
perf_event_open() currently gates perf_allow_kernel() only on !attr.exclude_kernel. However, users can still request kernel callchain collection with attr.exclude_callchain_kernel == 0 even when attr.exclude_kernel == 1. That still requires kernel profiling privilege, but the existing check does not enforce it. Update the permission check to call perf_allow_kernel() when either kernel sampling is requested or kernel callchains are requested. This keeps permission checks aligned with requested data and prevents unprivileged use of kernel callchain capture. Signed-off-by: Dapeng Mi <dapeng1.mi@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://patch.msgid.link/20260616044654.3468742-9-dapeng1.mi@linux.intel.com
This commit is contained in:
parent
166f10836a
commit
a4573a3838
|
|
@ -13932,7 +13932,9 @@ SYSCALL_DEFINE5(perf_event_open,
|
|||
if (err)
|
||||
return err;
|
||||
|
||||
if (!attr.exclude_kernel) {
|
||||
if (!attr.exclude_kernel ||
|
||||
((attr.sample_type & PERF_SAMPLE_CALLCHAIN) &&
|
||||
!attr.exclude_callchain_kernel)) {
|
||||
err = perf_allow_kernel();
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user