Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zide Chen" <zide.chen@intel.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH V3 7/7] perf/x86/intel/uncore: Implement global init callback for GNR uncore
Date: Tue, 02 Jun 2026 16:44:49 +0000	[thread overview]
Message-ID: <20260602164450.3A7031F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260602144908.263680-8-zide.chen@intel.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Hardware trust boundary violation: A spoofed PCIe device can supply an arbitrary `global.ctl` value, leading to arbitrary MSR writes.
- [Medium] The newly added `uncore_msr_global_init()` uses the unchecked `wrmsrq_on_cpu()` function to write to an MSR address obtained from the hardware discovery table.
--

commit b0a74f9b5d22ecfcf334d277878f153181fb3107
Author: Zide Chen <zide.chen@intel.com>

perf/x86/intel/uncore: Implement global init callback for GNR uncore

On Sierra Forest and Clearwater Forest, the FRZ_ALL bit in the global
control register defaults to 0 at boot, but UBOX PMON units do not
work until the global control register is explicitly written with 0
to trigger hardware initialization properly.

> diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
> --- a/arch/x86/events/intel/uncore.c
> +++ b/arch/x86/events/intel/uncore.c
[ ... ]
> @@ -1731,6 +1731,16 @@ static int uncore_mmio_global_init(u64 ctl)
>  	return 0;
>  }
>  
> +static int uncore_msr_global_init(int die, u64 msr)
> +{
> +	int cpu = uncore_die_to_cpu(die);
> +
> +	if (cpu == -1)
> +		return -ENODEV;
> +
> +	return wrmsrq_on_cpu(cpu, msr, 0);

[Severity: Medium]
Since the msr parameter is derived from global.ctl which is read from
the hardware discovery table, could an incorrect value from firmware trigger
an unchecked MSR access warning?  Would it be better to use
wrmsrq_safe_on_cpu() here to prevent scary traces if the hardware table
is invalid?

> +}
> +
>  static const struct uncore_plat_init nhm_uncore_init __initconst = {
[ ... ]
> diff --git a/arch/x86/events/intel/uncore_discovery.c b/arch/x86/events/intel/uncore_discovery.c
> --- a/arch/x86/events/intel/uncore_discovery.c
> +++ b/arch/x86/events/intel/uncore_discovery.c
[ ... ]
> @@ -287,7 +287,7 @@ static int __parse_discovery_table(struct uncore_discovery_domain *domain,
>  	if (!io_addr)
>  		return -ENOMEM;
>  
> -	if (domain->global_init && domain->global_init(global.ctl)) {
> +	if (domain->global_init && domain->global_init(die, global.ctl)) {

[Severity: Critical]
Does this allow an external device to write 0 to arbitrary MSRs?

The uncore discovery code scans the PCI bus for devices matching the Intel
Vendor ID and discovery Device ID without restricting the search to internal
CPU buses.  If a malicious external PCIe device (e.g., via Thunderbolt)
spoofs these IDs, it can provide a fake discovery table.

Could this attacker-controlled global.ctl value then be passed to
uncore_msr_global_init() and used as the msr index, allowing an attacker
to overwrite security-sensitive MSRs like MSR_LSTAR or MSR_GS_BASE with 0?

>  		ret = -ENODEV;
>  		goto out;
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260602144908.263680-1-zide.chen@intel.com?part=7

  reply	other threads:[~2026-06-02 16:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02 14:49 [PATCH V3 0/7] perf/x86/intel/uncore: Bug fixes and cleanups Zide Chen
2026-06-02 14:49 ` [PATCH V3 1/7] perf/x86/intel/uncore: Fix discovery unit lookup for multi-die systems Zide Chen
2026-06-02 15:22   ` sashiko-bot
2026-06-02 14:49 ` [PATCH V3 2/7] perf/x86/intel/uncore: Guard against invalid box control address Zide Chen
2026-06-02 15:39   ` sashiko-bot
2026-06-02 14:49 ` [PATCH V3 3/7] perf/x86/intel/uncore: Fix PCI device refcount leak in UPI discovery Zide Chen
2026-06-02 14:49 ` [PATCH V3 4/7] perf/x86/intel/uncore: Defer ADL global PMON enable to enable_box() Zide Chen
2026-06-02 16:05   ` sashiko-bot
2026-06-02 14:49 ` [PATCH V3 5/7] perf/x86/intel/uncore: Move die_to_cpu() to uncore.c Zide Chen
2026-06-02 14:49 ` [PATCH V3 6/7] perf/x86/intel/uncore: Fix uncore_die_to_cpu() for offline dies Zide Chen
2026-06-02 14:49 ` [PATCH V3 7/7] perf/x86/intel/uncore: Implement global init callback for GNR uncore Zide Chen
2026-06-02 16:44   ` sashiko-bot [this message]
2026-06-03  2:48 ` [PATCH V3 0/7] perf/x86/intel/uncore: Bug fixes and cleanups Mi, Dapeng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260602164450.3A7031F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zide.chen@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox