lkml.org 
[lkml]   [2019]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 2/2] perf: Disallow aux_output for kernel events
Date
Alexander Shishkin <alexander.shishkin@linux.intel.com> writes:

> + /*
> + * Grouping is not supported for kernel events, neither is 'AUX',
> + * make sure the caller's intentions are adjusted.
> + */
> + if (attr->aux_output)
> + return -EINVAL;

Should have been ERR_PTR(-EINVAL).

From 72e1839403cb10da589873e1e529778e1f087b96 Mon Sep 17 00:00:00 2001
From: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Date: Wed, 30 Oct 2019 15:27:35 +0200
Subject: [PATCH] perf: Disallow aux_output for kernel events

Commit

ab43762ef0109 ("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 <alexander.shishkin@linux.intel.com>
---
kernel/events/core.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6d0d4b14f11c..b1aa5237052b 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -11555,6 +11555,13 @@ perf_event_create_kernel_counter(struct perf_event_attr *attr, int cpu,
struct perf_event *event;
int err;

+ /*
+ * Grouping is not supported for kernel events, neither is 'AUX',
+ * make sure the caller's intentions are adjusted.
+ */
+ if (attr->aux_output)
+ return ERR_PTR(-EINVAL);
+
event = perf_event_alloc(attr, cpu, task, NULL, NULL,
overflow_handler, context, -1);
if (IS_ERR(event)) {
--
2.24.0.rc1
\
 
 \ /
  Last update: 2019-10-31 07:33    [W:0.061 / U:0.464 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site