[SRU][J][PATCH v2 05/20] x86/CPU/AMD: Move the Zen3 BTC_NO detection to the Zen3 init function
Juerg Haefliger
juerg.haefliger at canonical.com
Mon Oct 20 14:19:52 UTC 2025
From: "Borislav Petkov (AMD)" <bp at alien8.de>
No functional changes.
Signed-off-by: Borislav Petkov (AMD) <bp at alien8.de>
Reviewed-by: Nikolay Borisov <nik.borisov at suse.com>
Link: http://lore.kernel.org/r/20231120104152.13740-4-bp@alien8.de
(cherry picked from commit affc66cb96f865b3763a8e18add52e133d864f04)
CVE-2024-53114
Signed-off-by: Juerg Haefliger <juerg.haefliger at canonical.com>
---
arch/x86/kernel/cpu/amd.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 000f7643a2b6..bc864477e27a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1095,14 +1095,6 @@ static void init_amd_zn(struct cpuinfo_x86 *c)
/* Erratum 1076: CPB feature bit not being set in CPUID. */
if (!cpu_has(c, X86_FEATURE_CPB))
set_cpu_cap(c, X86_FEATURE_CPB);
-
- /*
- * Zen3 (Fam19 model < 0x10) parts are not susceptible to
- * Branch Type Confusion, but predate the allocation of the
- * BTC_NO bit.
- */
- if (c->x86 == 0x19 && !cpu_has(c, X86_FEATURE_BTC_NO))
- set_cpu_cap(c, X86_FEATURE_BTC_NO);
}
}
@@ -1159,6 +1151,15 @@ static void init_amd_zen2(struct cpuinfo_x86 *c)
static void init_amd_zen3(struct cpuinfo_x86 *c)
{
+ if (!cpu_has(c, X86_FEATURE_HYPERVISOR)) {
+ /*
+ * Zen3 (Fam19 model < 0x10) parts are not susceptible to
+ * Branch Type Confusion, but predate the allocation of the
+ * BTC_NO bit.
+ */
+ if (!cpu_has(c, X86_FEATURE_BTC_NO))
+ set_cpu_cap(c, X86_FEATURE_BTC_NO);
+ }
}
static void init_amd_zen4(struct cpuinfo_x86 *c)
--
2.48.1
More information about the kernel-team
mailing list