From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96AF0C433B4 for ; Fri, 16 Apr 2021 15:01:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8018361166 for ; Fri, 16 Apr 2021 15:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245458AbhDPPCV (ORCPT ); Fri, 16 Apr 2021 11:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244996AbhDPPCO (ORCPT ); Fri, 16 Apr 2021 11:02:14 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 043F1C061756; Fri, 16 Apr 2021 08:01:49 -0700 (PDT) Date: Fri, 16 Apr 2021 15:01:47 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618585308; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/wMi5JdLCNyJFe1ycKZ8tpxYacpi4EsPkXKT5cRNuYc=; b=Cv4Z/HKoUBAQpMwzMyMAicPRovSJwiosdT5dfn8/9cC7+Gbm9fJOJ/phDiMZEOAptJAvlq MpCjvmIW9n+TgMLzah6/cd/B5aHNC/KCMddVpcy5raUVjY9gKkI0RQP4R6nqvjOpmU9MJe 9jPKEmhrWYCxssJnFC7j5Ru1s5x75rVoayBdK4ov/25ZDnEa9uzTLaLbc2lU6dpNaBRzb4 rjkRiYxcsrjlu6vv3599U7BfR1O0DadFMKBqyOFfEbaw5agke4d8BgHhzJYSalZb20lw+f WLXta/HA8UH5apotb/3MAu618gt6z31OhO4iEvMNsHBYSZfBUOqlkBys5guprA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618585308; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/wMi5JdLCNyJFe1ycKZ8tpxYacpi4EsPkXKT5cRNuYc=; b=VDawU8DXQe1Dqr4ZG+MYlJtMoqIuvumksHpLbZQydtJDd4tfhhrt1+L3uNFezogLb9qnxk /AKdcFNJyxiVKBDw== From: "tip-bot2 for Nathan Chancellor" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/core] x86/events/amd/iommu: Fix sysfs type mismatch Cc: Nathan Chancellor , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210415001112.3024673-1-nathan@kernel.org> References: <20210415001112.3024673-1-nathan@kernel.org> MIME-Version: 1.0 Message-ID: <161858530728.29796.17592838141405180153.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the perf/core branch of tip: Commit-ID: bccae9d7b013bd708ece414f74defaee56790e1d Gitweb: https://git.kernel.org/tip/bccae9d7b013bd708ece414f74defaee56790e1d Author: Nathan Chancellor AuthorDate: Wed, 14 Apr 2021 17:11:11 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 16 Apr 2021 16:32:44 +02:00 x86/events/amd/iommu: Fix sysfs type mismatch dev_attr_show() calls _iommu_event_show() via an indirect call but _iommu_event_show()'s type does not currently match the type of the show() member in 'struct device_attribute', resulting in a Control Flow Integrity violation. $ cat /sys/devices/amd_iommu_1/events/mem_dte_hit csource=0x0a $ dmesg | grep "CFI failure" [ 3526.735140] CFI failure (target: _iommu_event_show...): Change _iommu_event_show() and 'struct amd_iommu_event_desc' to 'struct device_attribute' so that there is no more CFI violation. Fixes: 7be6296fdd75 ("perf/x86/amd: AMD IOMMU Performance Counter PERF uncore PMU implementation") Signed-off-by: Nathan Chancellor Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20210415001112.3024673-1-nathan@kernel.org --- arch/x86/events/amd/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/amd/iommu.c b/arch/x86/events/amd/iommu.c index be50ef8..6a98a76 100644 --- a/arch/x86/events/amd/iommu.c +++ b/arch/x86/events/amd/iommu.c @@ -81,12 +81,12 @@ static struct attribute_group amd_iommu_events_group = { }; struct amd_iommu_event_desc { - struct kobj_attribute attr; + struct device_attribute attr; const char *event; }; -static ssize_t _iommu_event_show(struct kobject *kobj, - struct kobj_attribute *attr, char *buf) +static ssize_t _iommu_event_show(struct device *dev, + struct device_attribute *attr, char *buf) { struct amd_iommu_event_desc *event = container_of(attr, struct amd_iommu_event_desc, attr);