From: Jiri Olsa <[email protected]> To be able to check the owner task permission in event_init PMU callback, we need to set the owner before it is called.
Cc: Alexander Yarygin <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Corey Ashford <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> --- kernel/events/core.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 37797dd..a36ebfe 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6751,6 +6751,7 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, struct task_struct *task, struct perf_event *group_leader, struct perf_event *parent_event, + struct task_struct *owner, perf_overflow_handler_t overflow_handler, void *context) { @@ -6829,6 +6830,9 @@ perf_event_alloc(struct perf_event_attr *attr, int cpu, perf_event__state_init(event); + if (owner) + event->owner = owner; + pmu = NULL; hwc = &event->hw; @@ -7141,7 +7145,7 @@ SYSCALL_DEFINE5(perf_event_open, get_online_cpus(); event = perf_event_alloc(&attr, cpu, task, group_leader, NULL, - NULL, NULL); + current, NULL, NULL); if (IS_ERR(event)) { err = PTR_ERR(event); goto err_cpus; @@ -7293,8 +7297,6 @@ SYSCALL_DEFINE5(perf_event_open, put_online_cpus(); - event->owner = current; - mutex_lock(¤t->perf_event_mutex); list_add_tail(&event->owner_entry, ¤t->perf_event_list); mutex_unlock(¤t->perf_event_mutex); @@ -7353,7 +7355,7 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu, * Get the target context (task or percpu): */ - event = perf_event_alloc(attr, cpu, task, NULL, NULL, + event = perf_event_alloc(attr, cpu, task, NULL, NULL, NULL, overflow_handler, context); if (IS_ERR(event)) { err = PTR_ERR(event); @@ -7674,11 +7676,9 @@ inherit_event(struct perf_event *parent_event, if (parent_event->parent) parent_event = parent_event->parent; - child_event = perf_event_alloc(&parent_event->attr, - parent_event->cpu, - child, - group_leader, parent_event, - NULL, NULL); + child_event = perf_event_alloc(&parent_event->attr, parent_event->cpu, + child, group_leader, parent_event, + NULL, NULL, NULL); if (IS_ERR(child_event)) return child_event; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

