mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Ihor Solodrai" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Ihor Solodrai <ihor.solodrai@linux.dev>,
	"Borislav Petkov (AMD)" <bp@alien8.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/cpu] x86/cpu: Don't transiently clear the boot CPU's capabilities
Date: Thu, 17 Sep 2026 02:00:06 -0000	[thread overview]
Message-ID: <178961040663.1720534.16515337025931220992.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260916195203.1099646-6-ihor.solodrai@linux.dev>

The following commit has been merged into the x86/cpu branch of tip:

Commit-ID:     2711d67bc3a776abcfc651ad87be5d29ada19166
Gitweb:        https://git.kernel.org/tip/2711d67bc3a776abcfc651ad87be5d29ada19166
Author:        Ihor Solodrai <ihor.solodrai@linux.dev>
AuthorDate:    Wed, 16 Sep 2026 12:52:03 -07:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Thu, 17 Sep 2026 02:05:39 +02:00

x86/cpu: Don't transiently clear the boot CPU's capabilities

On the boot CPU, identify_cpu() runs from arch_cpu_finalize_init(), with
interrupts enabled and before alternatives are patched. So
cpu_feature_enabled() still evaluates against boot_cpu_data.

identify_cpu() rebuilds c->x86_capability from scratch: the reset zeroes the
array and the CPUID rescan fills it in again. An interrupt delivered in that
window finds X86_FEATURE_LA57 clear in boot_cpu_data, so pgtable_l5_enabled()
is false and KASAN checks a 5-level address against the 4-level addressability
limit. The result is a bogus "wild-memory-access" report, and under
kasan_multi_shot a report storm that wedges the boot.

The boot CPU has already been scanned by early_identify_cpu(), with interrupts
disabled, and its capabilities cannot have changed since. Reset only the CPUs
which have not been scanned yet.

The window is as old as identify_cpu() rebuilding the capabilities.  Commit

  39b9552281ab ("x86/mm: Optimize boot-time paging mode switching cost")

merely let KASAN notice it by making pgtable_l5_enabled() read the feature
bit. So no Fixes: tag.

Closes: https://lore.kernel.org/bpf/20260610175651.647515-1-ihor.solodrai@linux.dev/
Signed-off-by: Ihor Solodrai <ihor.solodrai@linux.dev>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260916195203.1099646-6-ihor.solodrai@linux.dev
---
 arch/x86/kernel/cpu/common.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 156a7b8..7d4ff29 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -2000,8 +2000,6 @@ static void identify_cpu(struct cpuinfo_x86 *c)
 
 	c->loops_per_jiffy = loops_per_jiffy;
 
-	init_cpu_info(c);
-
 	if (!cpuid_feature())
 		identify_cpu_without_cpuid(c);
 
@@ -2186,6 +2184,7 @@ void identify_secondary_cpu(unsigned int cpu)
 		*c = boot_cpu_data;
 	c->cpu_index = cpu;
 
+	init_cpu_info(c);
 	identify_cpu(c);
 	x86_spec_ctrl_setup_ap();
 	update_srbds_msr();

      reply	other threads:[~2026-09-17  2:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 19:51 [PATCH v3 0/5] x86/cpu: Refactor identify_cpu() Ihor Solodrai
2026-09-16 19:51 ` [PATCH v3 1/5] x86/cpu: Factor init_cpu_info() out of identify_cpu() Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 1/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 2/5] x86/cpu: Initialize boot CPU cpuinfo defaults early Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 2/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 3/5] x86/cpu: Inline generic_identify() into identify_cpu() Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 3/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 4/5] x86/cpu: Move 32-bit SEP setup " Ihor Solodrai
2026-09-17  2:00   ` [tip: x86/cpu] " tip-bot2 for Ihor Solodrai
2026-09-17 23:49   ` [PATCH v3 4/5] " bot+bpf-ci
2026-09-16 19:52 ` [PATCH v3 5/5] x86/cpu: Don't transiently clear the boot CPU's capabilities Ihor Solodrai
2026-09-17  2:00   ` tip-bot2 for Ihor Solodrai [this message]

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=178961040663.1720534.16515337025931220992.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=bp@alien8.de \
    --cc=ihor.solodrai@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=x86@kernel.org \
    /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

all inboxes | Powered by JetHome®