Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp384661pxb; Fri, 16 Apr 2021 08:03:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPpb43MK2+FBYrED5j+sWaPrF6CyVkzj5zS2vFBRATJ+whqBbD4C6+kQj3+pgpt60ZZaeR X-Received: by 2002:a05:6402:17c6:: with SMTP id s6mr10505565edy.319.1618585389503; Fri, 16 Apr 2021 08:03:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618585389; cv=none; d=google.com; s=arc-20160816; b=gY+qW6cmE8JT3NLta25mmzuG3O3Klh1SRZNzSx4X2BSUA8A+yhz9Ufbyt5KwqZf5Ei SP9akxmRpqmFwUXCjOQoUoPTRXfJSLzfSadaij5pHemhRI3UgTnUA25sfLHVWMQp460J Xvwhb0OnKs5V5wRmolZStXDTC/1Qy6X66FBclzP+MFoYf+vkD7IZKNTKhA+XO+4eTGKz GfJIPiZVkW5Nc42HLmDSza3QFV38QmMfgzyjSOo1tW0G4QsFRaIBc14fJqXeFmYxIerz RfhiWh/4ASRSCeAokUeXM4Xmk6DVwuzMGYiVimrl+QiVqh1YoA+e+NuD9fybcxpFd0xG AMdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=jYZWPtDMrEcYhCUgO6OL6PA5yeacxbkEGBOxZmZxr2o=; b=v6xsWNh5lnxA1K0iSbTo+3nP7GO+gMOES2ZqisoJrN7MFzvpOgBDMZ+qqsqXMTthc2 PPJYHTMIa2rsp73HIZn0G5aKCtvO5KMHphmj03Gb3UVTy+VnIGwSMKcsAvwH4e9zlcgz Jb/+Y83CH092lQK+AsO9+1P84Z+wm/Fs0+GnM67BN/5UZ+WyjrVQV5mUe99fiMDX1Ift BYIihifLpXwGIkIUwsfo6g5zMCFHBkmHPLEuoMgYoKvv2X2sfYa1vc9NIz/1Br0EbeeR gOzY3vQkjjN6yk9gmctqI5rJOAuP19jEBDxeYQrPQznVWhhmXtJfL2+eRF1J0HQV58HV sdlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UjdnVojh; dkim=neutral (no key) header.i=@linutronix.de header.b=MBZhr2ne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m10si4957200edd.22.2021.04.16.08.02.45; Fri, 16 Apr 2021 08:03:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=UjdnVojh; dkim=neutral (no key) header.i=@linutronix.de header.b=MBZhr2ne; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245326AbhDPPCR (ORCPT + 99 others); Fri, 16 Apr 2021 11:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244999AbhDPPCO (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 F0C6BC061574; Fri, 16 Apr 2021 08:01:49 -0700 (PDT) Date: Fri, 16 Apr 2021 15:01:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1618585307; 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=jYZWPtDMrEcYhCUgO6OL6PA5yeacxbkEGBOxZmZxr2o=; b=UjdnVojhsS8+Vo27cJ+tevrqLVVM0+jZ91rZy0/BWezxhkxMJqAl0Xx2NwkyO/WvcVI9PP t3KaWZEv8nKGWXy6fyENTTfnytMOxXXNc4bGyu9RxuZIiYn9awOU0gHrzQHwHD8PFfvBG2 aPnKNwixdObByDKD3G6AowUIGsXhqfUif4lKXq4pyx8ILueMMOYiAZXWurIL+8EFUzjXpG 8j4tulLSDsW7SGknIV1ZVdassg09SwNMmdrzVezra/HgW2ugOo0H93EPFRjek96X9AmIXD dMKjvsIK+N+fFwMvi95EBiu1XlejzbFbYVHxHzoSRhBCz8B7aOQ0wYSZfnzD3w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1618585307; 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=jYZWPtDMrEcYhCUgO6OL6PA5yeacxbkEGBOxZmZxr2o=; b=MBZhr2neHzVt0lPC7Nupp0wne9NmdnjvnHWgJVWJlxFMsE/QvdD/BSOXypILnxTLMdCXX0 Id7aHVWMXYeeocAA== 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] perf/amd/uncore: Fix sysfs type mismatch Cc: Nathan Chancellor , "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210415001112.3024673-2-nathan@kernel.org> References: <20210415001112.3024673-2-nathan@kernel.org> MIME-Version: 1.0 Message-ID: <161858530676.29796.11038219693282032016.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: b04c0cddff6d1d6656c7f7c08c0b8f07eb287564 Gitweb: https://git.kernel.org/tip/b04c0cddff6d1d6656c7f7c08c0b8f07eb287564 Author: Nathan Chancellor AuthorDate: Wed, 14 Apr 2021 17:11:12 -07:00 Committer: Peter Zijlstra CommitterDate: Fri, 16 Apr 2021 16:32:44 +02:00 perf/amd/uncore: Fix sysfs type mismatch dev_attr_show() calls the __uncore_*_show() functions via an indirect call but their 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_l3/format/umask config:8-15 $ dmesg | grep "CFI failure" [ 1258.174653] CFI failure (target: __uncore_umask_show...): Update the type in the DEFINE_UNCORE_FORMAT_ATTR macro to match 'struct device_attribute' so that there is no more CFI violation. Fixes: 06f2c24584f3 ("perf/amd/uncore: Prepare to scale for more attributes that vary per family") Signed-off-by: Nathan Chancellor Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20210415001112.3024673-2-nathan@kernel.org --- arch/x86/events/amd/uncore.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/amd/uncore.c b/arch/x86/events/amd/uncore.c index 7f014d4..582c0ff 100644 --- a/arch/x86/events/amd/uncore.c +++ b/arch/x86/events/amd/uncore.c @@ -275,14 +275,14 @@ static struct attribute_group amd_uncore_attr_group = { }; #define DEFINE_UNCORE_FORMAT_ATTR(_var, _name, _format) \ -static ssize_t __uncore_##_var##_show(struct kobject *kobj, \ - struct kobj_attribute *attr, \ +static ssize_t __uncore_##_var##_show(struct device *dev, \ + struct device_attribute *attr, \ char *page) \ { \ BUILD_BUG_ON(sizeof(_format) >= PAGE_SIZE); \ return sprintf(page, _format "\n"); \ } \ -static struct kobj_attribute format_attr_##_var = \ +static struct device_attribute format_attr_##_var = \ __ATTR(_name, 0444, __uncore_##_var##_show, NULL) DEFINE_UNCORE_FORMAT_ATTR(event12, event, "config:0-7,32-35");