powerpc/perf: Fix the guest crash issue with trace-imc
PATCH 1/1 powerpc/perf: Fix the guest crash issue with trace-imc
when perf kvm record with trace_imc event is attach to guest pid(with -p option), the qemu process gets killed with permission issue. This happens because trace_imc event requires admin privileges to monitor the process.If the qemu creates threads, by default child tasks also inherit the counters and if there is no permission to monitor qemu threads, we return permission denied ( EACCES ).
Fix this by returning EACCES only if there is no CAP_SYS_ADMIN and the event doesn’t have inheritance.
Fixes 012ae244845f ("powerpc/perf: Trace imc PMU functions")
Signed-off-by Athira Rajeev <[email protected]>
--- arch/powerpc/perf/imc-pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/imc-pmu.c +1 -1
@@ -1429,7 +1429,7 @@ static int trace_imc_event_init(struct perf_event *event)if (event->attr.type != event->pmu->type)return -ENOENT ; -if (!perfmon_capable ()) +if (!perfmon_capable () && !event->attr.inherit)return -EACCES ;/* Return if this is a couting event */
Signature · 1 line
1.8.3.1