Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp892491ybx; Wed, 30 Oct 2019 06:49:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqzUt98cSF8kraRJOudYKPzogMztkgll3sLmqrmzxMGZJE5UMWLuuiRCUI7he/cN8eOOr91X X-Received: by 2002:a17:906:d291:: with SMTP id ay17mr8960147ejb.85.1572443376304; Wed, 30 Oct 2019 06:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572443376; cv=none; d=google.com; s=arc-20160816; b=XcLFqJBjCDlPpEmhHT17Qcm9ecZohwgssm9GeoVl2SNx5ry7DS92aHVhsqsOzbbAuk 5s7AYnDWt9jzonTf0pgSUxYSNclbFo1Vlfp9KZsvBysYkfprRbdnUZHllXAHeW9INinN rU6YUHaThLosCoBREVKIsuHPhRQ2LTYRPZU74B7Fh8NXiFzXE2dR0wGWhLlCkqY2WLrK AClyrWl2+Nnb1JfB6rEZSmSb+w8xegbDjVkhlmWevhHdcwn7saQ3UwiIQiKVaB92Fx7T WnQ45oFmTX/org9tZ/KrCnLLI3UK1gsyEdokcSKK4DALd6Zk3BIYgLq1E9xdL6KVAWOZ kB5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ri8BnF7d6VUT8/SqoAFAMp5+3bhxMCK2uaQB1X2CcsY=; b=LnbnQi2B35E7xvWk8yynIKrfh76+JHG7C5EgWmhrFfurSyGCM1N66+Iq114SktQWj2 HKmKFcs28ZS7z7JZzXAgKlszOrBJ67WPNVvt0iMO/RTFnEhpVkSHccApbhsvNNiAmEN/ oVUd5qrCnOT9aYM4dxr5enNr2JcwqN50XMik7jEBdT5rDWGNXQVFiSw2uk/dTs7oIQNX rMc/LLLgp1+Tp8Kg2iZhoeIZUgaRU9lKlKVb6OTiaveDmUKIbSjazMS/UonG7SB4AYfi dkaUCRRhRaQFW6jLU1c8d9FnXfvf74Xff/iSwOR6vZ1dfHsKbWieeEVtfEGqKdf8Othr CPWw== 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 n9si1213559ejr.53.2019.10.30.06.49.12; Wed, 30 Oct 2019 06:49:36 -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 S1726643AbfJ3Nr7 (ORCPT + 99 others); Wed, 30 Oct 2019 09:47:59 -0400 Received: from mga17.intel.com ([192.55.52.151]:28792 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726585AbfJ3Nr6 (ORCPT ); Wed, 30 Oct 2019 09:47:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 06:47:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,247,1569308400"; d="scan'208";a="190281946" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 30 Oct 2019 06:47:39 -0700 From: Alexander Shishkin To: Peter Zijlstra Cc: Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org, Alexander Shishkin Subject: [PATCH 2/2] perf: Disallow aux_output for kernel events Date: Wed, 30 Oct 2019 15:47:31 +0200 Message-Id: <20191030134731.5437-3-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191030134731.5437-1-alexander.shishkin@linux.intel.com> References: <20191030134731.5437-1-alexander.shishkin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 d2f16546a2ab..d31cf601c710 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -11415,6 +11415,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 -EINVAL; + event = perf_event_alloc(attr, cpu, task, NULL, NULL, overflow_handler, context, -1); if (IS_ERR(event)) { -- 2.23.0