Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4424845rwl; Mon, 3 Apr 2023 05:01:28 -0700 (PDT) X-Google-Smtp-Source: AKy350bQ8qj/RiOcmZVX8Gbl8/A2B+1MzWVVGtteWCGwOJG8q5Ui5ltOujVbZF7a7YGvnTV2cOAz X-Received: by 2002:a17:906:d8d0:b0:932:3688:ae81 with SMTP id re16-20020a170906d8d000b009323688ae81mr34969126ejb.9.1680523288612; Mon, 03 Apr 2023 05:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680523288; cv=none; d=google.com; s=arc-20160816; b=LT93cpMDM4CocA2LyoS1bLD7kcNvApuk4+58PBcWdrjJ7RMPSEVVpkC+7n/htfQTkV a5JoV6qEBAHApggWMeAKtksGEoBYjnsfg1m4Cq9877nzdgKrYCaoJKRSDC2s3JKIwmK6 r5RGsSolc+HTHXr6wQNLgvO0dGq8PNWqBg/FPVTJIC+IZx0zEFGw94zM/KeRXIiP+22l rKzgKmvkzbn3K8kIc17V/SbC5dk23gVPr7A9XRgkgr0ybPK+JcUHRtejQ6Hxnfu5KslF /+UyipUQmP94yNhFZAGeZ0FhFCY94QOVNyEHeSHc4NCWBPJzLROm14i+pjez1DPRk4Fg B51g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=+9NEJKutNQRC3lO0K69vzyz/epgSipU/RnoPt0dhY6o=; b=idS46qaoKybVkQAuvexwSGuLKSbSrVxkiw75ghrgXwfD4h0kJ3ZGKnJeqYhOyE8Cdm DZRZnUkTwL2Kr4xdxe25JPpiuUylmIDbtnzJe8p8Aeq1eqBftxi6I2kNsb3B6xhKHcWv jXsguPz7fDYXD2hqkDZrl37YvoRQxSBNO7RwCHZGJmyUrx6chDSlM4FWGCHCd4aTqTYu KBYJhb+5zdAK4gjUe2gCv0YnGlalpdHjTRqxxWvnpW1oa7utmM6EKPNIvH67RawETqSr WxjPQnU+uAb8EaTPZOfrgepq2oNopf6mRyMhiPnxvhDnqTFRBwkOdPs1Jt/6Ui1vk5a3 mqAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l25-20020aa7c319000000b004a0db601db8si8068888edq.619.2023.04.03.05.00.58; Mon, 03 Apr 2023 05:01:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231912AbjDCLtN (ORCPT + 99 others); Mon, 3 Apr 2023 07:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231549AbjDCLtM (ORCPT ); Mon, 3 Apr 2023 07:49:12 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DE41030F6 for ; Mon, 3 Apr 2023 04:49:10 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 275091063; Mon, 3 Apr 2023 04:49:55 -0700 (PDT) Received: from e121345-lin.cambridge.arm.com (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F37DF3F6C4; Mon, 3 Apr 2023 04:49:09 -0700 (PDT) From: Robin Murphy To: will@kernel.org Cc: mark.rutland@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] perf/arm-cmn: Validate cycles events fully Date: Mon, 3 Apr 2023 12:49:05 +0100 Message-Id: <3124e8c276a1f513c1a415dc839ca4181b3c8bc8.1680522545.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.39.2.101.g768bb238c484.dirty MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DTC cycle count events don't have anything to validate or initialise in themselves, but we should not forget to still validate their whole group context. Otherwise, we may fail to correctly reject a contrived group containing an impossible number of cycles events. Signed-off-by: Robin Murphy --- drivers/perf/arm-cmn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c index 367d41c5d983..45819528facb 100644 --- a/drivers/perf/arm-cmn.c +++ b/drivers/perf/arm-cmn.c @@ -1558,7 +1558,7 @@ static int arm_cmn_event_init(struct perf_event *event) type = CMN_EVENT_TYPE(event); /* DTC events (i.e. cycles) already have everything they need */ if (type == CMN_TYPE_DTC) - return 0; + return arm_cmn_validate_group(cmn, event); eventid = CMN_EVENT_EVENTID(event); /* For watchpoints we need the actual XP node here */ -- 2.39.2.101.g768bb238c484.dirty