Skip to content

Commit dce5aff

Browse files
virtuosoIngo Molnar
authored andcommitted
perf/aux: Disallow aux_output for kernel events
Commit ab43762 ("perf: Allow normal events to output AUX data") added 'aux_output' bit to the attribute structure, which relies on AUX events and grouping, neither of which is supported for the kernel events. This notwithstanding, attempts have been made to use it in the kernel code, suggesting the necessity of an explicit hard -EINVAL. Fix this by rejecting attributes with aux_output set for kernel events. Signed-off-by: Alexander Shishkin <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent f25d8ba commit dce5aff

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

kernel/events/core.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11331,6 +11331,13 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
1133111331
struct perf_event *event;
1133211332
int err;
1133311333

11334+
/*
11335+
* Grouping is not supported for kernel events, neither is 'AUX',
11336+
* make sure the caller's intentions are adjusted.
11337+
*/
11338+
if (attr->aux_output)
11339+
return ERR_PTR(-EINVAL);
11340+
1133411341
event = perf_event_alloc(attr, cpu, task, NULL, NULL,
1133511342
overflow_handler, context, -1);
1133611343
if (IS_ERR(event)) {

0 commit comments

Comments
 (0)