Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp736301ybx; Wed, 30 Oct 2019 23:37:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjgKEl4bF5lMjDsRjPRUyo+T7nwdbi90yy/M+iwDFQ+oizcZ6mZxIO4ThCn/+gxX/jO2Ta X-Received: by 2002:a17:906:cc94:: with SMTP id oq20mr2197887ejb.263.1572503872017; Wed, 30 Oct 2019 23:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572503872; cv=none; d=google.com; s=arc-20160816; b=bxuAn9JI6NfkIIltm3dTmRMi294IF4q9E2kSX4k3sigsJEzP8u86dh6sxV73Y6i/Ny +HDCZe6m8CrW5blozrdiGMP+sH0BmaPNNi00a+2F8QIcuBOi5DB5eW6/DpTmxsZ1B8Jj Wit9UlAjUO73vUSSOZjTBIbPNNB6IAD49iMiUF8rzck4BGlmVfO3OoXkotuGMR+D0LGC xRb9XyCdRrHaleghxVfje1UJmqnMIAF/eejjmS3x7Fmf898Sz9qSYl9jbi/q7Q1nKlVG SBp0UbiBN1Y21z4xJACDh19mxda11aVCKgi4e+pHySQiJEsf6PE1CXKW6P+0NQGfvhdy Wigg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=wss70c6en0qIhIS9YKhBsS4/tlchvCGzpXekYgiJWfI=; b=H67axWzub8HB/pGcKaTYE5PbI1pazewWTOIU0RafzitUwIfuYTNZggNYsPzdvnilYa 4TTjYc/k2JxSj32APCgMahtDVNbjMrzXWRdLzSrPWdXUhXVfnU/gSFzg0DD6vEuQfAkh unPE/GajENDS80KPKWpqdViF2EKy45pVJ2cWe809oseB942zyR5XgYyPHV7YFXVVGnDR LVx3hKREnwbku9xsQpxSD45E3H/cwgtaocgPFvXlXKVDHvXci2uVVDfNumPRWcyVnHiO 8uppy9Fcvs3cTrS82Vtu8UiLBKuuIZKLkgeTmXqfQ5Vk38M/M7r2hn0WHhwzm74ldZvW LtIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v20si3060966edm.254.2019.10.30.23.37.13; Wed, 30 Oct 2019 23:37:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726596AbfJaGcC (ORCPT + 99 others); Thu, 31 Oct 2019 02:32:02 -0400 Received: from mga14.intel.com ([192.55.52.115]:59022 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbfJaGcC (ORCPT ); Thu, 31 Oct 2019 02:32:02 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 23:32:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,250,1569308400"; d="scan'208";a="230739282" Received: from um.fi.intel.com (HELO um) ([10.237.72.57]) by fmsmga002.fm.intel.com with ESMTP; 30 Oct 2019 23:31:59 -0700 From: Alexander Shishkin To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org, alexander.shishkin@linux.intel.com Subject: Re: [PATCH 2/2] perf: Disallow aux_output for kernel events In-Reply-To: <20191030134731.5437-3-alexander.shishkin@linux.intel.com> References: <20191030134731.5437-1-alexander.shishkin@linux.intel.com> <20191030134731.5437-3-alexander.shishkin@linux.intel.com> Date: Thu, 31 Oct 2019 08:31:59 +0200 Message-ID: <87h83pfmsg.fsf@ashishki-desk.ger.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alexander Shishkin 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 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 --- 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