public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/cpu/centaur: Disable X86_FEATURE_FSGSBASE on Zhaoxin C4600
@ 2026-02-28 17:37 Yao Zi
  2026-02-28 19:06 ` Borislav Petkov
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: Yao Zi @ 2026-02-28 17:37 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen,
	Andrew Cooper, H. Peter Anvin
  Cc: x86, linux-kernel, Yao Zi, stable

Zhaoxin C4600, which names itself as CentaurHauls, claims
X86_FEATURE_FSGSBASE support in CPUID, while execution of fsgsbase-
related instructions fails with #UD exception. This will cause kernel
to crash early in current_save_fsgs().

Let's disable the feature on this problematic CPU and warn the user
about the quirk. x86_model_id is used to match the platform to avoid
unexpectedly breaking other CentaurHauls cores with conflicting
family/model ID.

Cc: stable@vger.kernel.org
Signed-off-by: Yao Zi <me@ziyao.cc>
---
 arch/x86/kernel/cpu/centaur.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 81695da9c524..3773784ba6a9 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -108,6 +108,29 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
 	}
 }
 
+/*
+ * Zhaoxin C4600 (family 6, model 15) names itself as CentaurHauls, it claims
+ * X86_FEATURE_FSGSBASE support in CPUID, while executing any fsgsbase-related
+ * instructions on it results in #UD.
+ */
+static void fixup_zhaoxin_fsgsbase(struct cpuinfo_x86 *c)
+{
+	const char *name, *model_names[] = {
+		"C-QuadCore C4600"
+	};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(model_names); i++) {
+		name = model_names[i];
+
+		if (!strncmp(c->x86_model_id, name, strlen(name))) {
+			pr_warn_once("CPU has broken FSGSBASE support\n");
+			setup_clear_cpu_cap(X86_FEATURE_FSGSBASE);
+			return;
+		}
+	}
+}
+
 static void init_centaur(struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_X86_32
@@ -201,6 +224,8 @@ static void init_centaur(struct cpuinfo_x86 *c)
 	set_cpu_cap(c, X86_FEATURE_LFENCE_RDTSC);
 #endif
 
+	fixup_zhaoxin_fsgsbase(c);
+
 	init_ia32_feat_ctl(c);
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 25+ messages in thread
* Re: [PATCH] x86/cpu/centaur: Disable X86_FEATURE_FSGSBASE on Zhaoxin C4600
@ 2026-03-05 20:26 Christian Ludloff
  2026-03-12  2:18 ` Tony W Wang-oc
  0 siblings, 1 reply; 25+ messages in thread
From: Christian Ludloff @ 2026-03-05 20:26 UTC (permalink / raw)
  To: TonyWWang-oc
  Cc: me, andrew.cooper3, bp, dave.hansen, hpa, linux-kernel, mingo,
	stable, tglx, x86, David Wang, lukelin, brucechang,
	TimGuo@zhaoxin.com, cooperyan, benjaminpan, TimGuo-oc, QiyuanWang,
	HerryYang, CobeChen@zhaoxin.com

Tony,

can you confirm whether F=6 M=1F is affected or not?
(Supposedly that's ZX-D... but the F in the model does
make me wonder/ask.)

Presumably the 6FE and 10690 microcodes which are
out in the wild do not fix the bug, correct?

000006fe_00000000_20110809_8f396f73
000006fe_00000000_20110809_8f397072
000006fe_00000001_20160525_7214d1e1
000006fe_00000001_20170109_25646399
000006fe_00000001_20180726_6e07329b
000006fe_00000001_20180726_6e1e984b

00010690_00000000_20110809_259878a5
00010690_00000001_20160525_3c34fc1a
00010690_00000001_20170109_a8b24dc2
00010690_00000001_20180726_0c55f25d
00010690_00000001_20180726_41faefde

As for making the code conditional for Centaur/Zhaoxin,
stepping E seems to be when FSGSBASE arrived – and
while there are CPUID dumps for 6FE that say VIA Eden
it is possible that they too have the bug.

As for making the code conditional for Zhaoxin models in
the string, that would require more than just C4600 – the
collection of known dumps includes others.

--
C.

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-03-18  3:44 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-28 17:37 [PATCH] x86/cpu/centaur: Disable X86_FEATURE_FSGSBASE on Zhaoxin C4600 Yao Zi
2026-02-28 19:06 ` Borislav Petkov
2026-03-01  9:27   ` Yao Zi
2026-03-01 18:37     ` David Laight
2026-03-02  5:09       ` Yao Zi
2026-03-01  0:33 ` Dave Hansen
2026-03-01  9:10   ` Yao Zi
2026-03-01 10:28   ` Borislav Petkov
2026-03-01 16:29 ` Andrew Cooper
2026-03-02  5:08   ` Yao Zi
2026-03-02  9:36     ` Andrew Cooper
2026-03-05  9:03 ` Tony W Wang-oc
2026-03-05 12:40   ` Andrew Cooper
2026-03-05 14:04   ` Yao Zi
2026-03-05 14:10     ` Andrew Cooper
2026-03-05 14:11   ` David Laight
2026-03-05 16:20   ` Dave Hansen
2026-03-12  2:14     ` Tony W Wang-oc
2026-03-12 15:52       ` Dave Hansen
2026-03-17  7:41         ` Tony W Wang-oc
2026-03-17 15:21           ` Dave Hansen
2026-03-18  3:44             ` Tony W Wang-oc
  -- strict thread matches above, loose matches on Subject: below --
2026-03-05 20:26 Christian Ludloff
2026-03-12  2:18 ` Tony W Wang-oc
2026-03-12 16:31   ` Christian Ludloff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox