Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fix from Ingo Molnar: "A single fix to not allow nonsensical event groups that result in kernel warnings" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/core: Fix group {cpu,task} validation
This commit is contained in:
commit
53ede64de3
|
@ -10032,28 +10032,27 @@ SYSCALL_DEFINE5(perf_event_open,
|
||||||
goto err_context;
|
goto err_context;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do not allow to attach to a group in a different
|
* Make sure we're both events for the same CPU;
|
||||||
* task or CPU context:
|
* grouping events for different CPUs is broken; since
|
||||||
|
* you can never concurrently schedule them anyhow.
|
||||||
*/
|
*/
|
||||||
if (move_group) {
|
if (group_leader->cpu != event->cpu)
|
||||||
/*
|
goto err_context;
|
||||||
* Make sure we're both on the same task, or both
|
|
||||||
* per-cpu events.
|
|
||||||
*/
|
|
||||||
if (group_leader->ctx->task != ctx->task)
|
|
||||||
goto err_context;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure we're both events for the same CPU;
|
* Make sure we're both on the same task, or both
|
||||||
* grouping events for different CPUs is broken; since
|
* per-CPU events.
|
||||||
* you can never concurrently schedule them anyhow.
|
*/
|
||||||
*/
|
if (group_leader->ctx->task != ctx->task)
|
||||||
if (group_leader->cpu != event->cpu)
|
goto err_context;
|
||||||
goto err_context;
|
|
||||||
} else {
|
/*
|
||||||
if (group_leader->ctx != ctx)
|
* Do not allow to attach to a group in a different task
|
||||||
goto err_context;
|
* or CPU context. If we're moving SW events, we'll fix
|
||||||
}
|
* this up later, so allow that.
|
||||||
|
*/
|
||||||
|
if (!move_group && group_leader->ctx != ctx)
|
||||||
|
goto err_context;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only a group leader can be exclusive or pinned
|
* Only a group leader can be exclusive or pinned
|
||||||
|
|
Loading…
Reference in New Issue