Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4619411pxj; Wed, 12 May 2021 09:22:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy0qAdIu8jF5bRG9NeLEvvu/yWE68Cb+29sUXqRRTTJXmjgPAQ1vgVQpsd6pOtZRRXav3m8 X-Received: by 2002:a17:906:c827:: with SMTP id dd7mr38804839ejb.225.1620836537552; Wed, 12 May 2021 09:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620836537; cv=none; d=google.com; s=arc-20160816; b=iZFrrDXHjpNItkCtE+y7tPo/lGLASh1JwMfXKvQgdoB0fcBz1VWpCgo9iecD8/szG8 QHEL2Wc3QnqnKbqD239AVpoPoyEN7PzhYNIQXJ2boEFWw4n+KSO4yYfPKzvhpnS9O3H6 uUhRtGlE7fqIwoV+yZVXdWRDoxfAtwFL4OVW6e+hL0T32fjCqEgnU7O8ORia+uM/l8hT v/mybNn+Wfh4ZdfBG/7U9dLoJTnmeq9uBKarIxWS+jRdFK0VuWQrg5r1VG/4l9+MfmKB 8SV4GBhlH0iUn+LnnFc4gXhd3VmX/xzqQrSxBaQKEG9fVmui/Hv61Drq9zWbDetEi2Pf L4jQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=927HhjyHJ6niFqnBgbNEjzm+1v47IsVnV9NF/2Z39os=; b=PBmRrBDe3zBQctEb+gHv0xECEiJHFsgxVWfh+4qVEKJsr04vvXzWVNa6b2OHlktGS8 tokwKIrwBonji8oire8QerrvzRR7M1o0OFQ9Ekk5+Hb0GCKFHmP3qTLdf/VBBtQo24s+ VeUSZxUVxQmid0FfeRPLW1eZK86g3zkuJj9s/tXb2hY8+vkUJ1sNwDmWS0sCdCdQNEJP Y081yogFAd/3B4IzX/hRHH46axkjCCL806qryugXU1ZmisDaBGncXsoi9wCg8bkjzJGj EGKzb3YZ7iWji8rCdrDPkCwHqDrWJVTgz8OZZqNNTCtCJubmnOZDaHs3hL4KZmCfi2LA kEnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v0VwHQpm; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si9059edx.581.2021.05.12.09.21.54; Wed, 12 May 2021 09:22:17 -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=@linuxfoundation.org header.s=korg header.b=v0VwHQpm; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239273AbhELQPa (ORCPT + 99 others); Wed, 12 May 2021 12:15:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:46830 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234005AbhELPb7 (ORCPT ); Wed, 12 May 2021 11:31:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BB46261C38; Wed, 12 May 2021 15:16:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832591; bh=8jYJUo+MJWKNPzGWeVdRxkFpv2loBomQp5NniyhTeX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0VwHQpmZ4uVujm1y6P0wUunPH0S9fGHzNLyDvSJo1Bk04om9cjRnPf8Z8SH1miBl XbiyPkiPcaiolR0euzajabbKoTESEfUzeU8BfvrUPa1Hk1sRu1Hfk7B5rM1hx4d25M Y8gdF/cGL9QqLcbhEnnqvilTYgAI0j1CJntQn8MY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.10 343/530] perf/amd/uncore: Fix sysfs type mismatch Date: Wed, 12 May 2021 16:47:33 +0200 Message-Id: <20210512144831.067141740@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nathan Chancellor [ Upstream commit 5deac80d4571dffb51f452f0027979d72259a1b9 ] 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 Signed-off-by: Sasha Levin --- 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 7f014d450bc2..582c0ffb5e98 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"); -- 2.30.2