[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aBnFRrnZQ9HwwULK@gmail.com>
Date: Tue, 6 May 2025 10:16:06 +0200
From: Ingo Molnar <mingo@...nel.org>
To: "Ahmed S. Darwish" <darwi@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Cooper <andrew.cooper3@...rix.com>,
"H. Peter Anvin" <hpa@...or.com>,
John Ogness <john.ogness@...utronix.de>, x86@...nel.org,
x86-cpuid@...ts.linux.dev, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v1 13/26] x86/cpuid: Scan CPUID(0x2)
* Ahmed S. Darwish <darwi@...utronix.de> wrote:
> +static void cpuid_read_0x2(const struct cpuid_scan_entry *e, struct cpuid_read_output *output)
> +{
> + union leaf_0x2_regs *regs = (union leaf_0x2_regs *)output->leaf;
> + struct leaf_0x2_0 *l2 = (struct leaf_0x2_0 *)output->leaf;
> + int invalid_regs = 0;
> +
> + /*
> + * All Intel CPUs must report an iteration count of 1. In case of
> + * bogus hardware, keep the leaf marked as invalid at the CPUID table.
> + */
> + cpuid_subleaf(e->leaf, e->subleaf, l2);
> + if (l2->iteration_count != 0x01)
> + return;
> +
> + /*
> + * The most significant bit (MSB) of each register must be clear.
> + * If a register is malformed, replace its descriptors with NULL.
> + */
> + for (int i = 0; i < 4; i++) {
> + if (regs->reg[i].invalid) {
> + regs->regv[i] = 0;
> + invalid_regs++;
> + }
Could we please emit a one-time syslog warning & diagnostic when we run
across invalid or otherwise weird looking CPUID data, instead of just
silently skipping and sanitizing it?
Thanks,
Ingo
Powered by blists - more mailing lists