linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode()
@ 2025-07-22 12:28 Michael Zhivich
  2025-07-22 14:22 ` Borislav Petkov
  0 siblings, 1 reply; 12+ messages in thread
From: Michael Zhivich @ 2025-07-22 12:28 UTC (permalink / raw)
  To: stable, bp; +Cc: tglx, mingo, dave.hansen, x86, linux-kernel, Michael Zhivich

For kernels compiled with CONFIG_INIT_STACK_NONE=y, the value of __reserved
field in zen_patch_rev union on the stack may be garbage.  If so, it will
prevent correct microcode check when consulting p.ucode_rev, resulting in
incorrect mitigation selection.

Cc: <stable@vger.kernel.org>
Signed-off-by:  Michael Zhivich <mzhivich@akamai.com>
Fixes: 7a0395f6607a5 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
---

Changes in v2:
- Rework patch per feedback
- Add Cc: stable

 arch/x86/kernel/cpu/amd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index efd42ee9d1cc..289ff197b1b3 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -378,6 +378,8 @@ static bool amd_check_tsa_microcode(void)
 	p.model		= c->x86_model;
 	p.ext_model	= c->x86_model >> 4;
 	p.stepping	= c->x86_stepping;
+	/* reserved bits are expected to be 0 in test below */
+	p.__reserved    = 0;
 
 	if (cpu_has(c, X86_FEATURE_ZEN3) ||
 	    cpu_has(c, X86_FEATURE_ZEN4)) {
-- 
2.34.1


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

end of thread, other threads:[~2025-07-29 14:38 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 12:28 [PATCH v2] x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode() Michael Zhivich
2025-07-22 14:22 ` Borislav Petkov
2025-07-22 16:56   ` Greg Kroah-Hartman
2025-07-23 13:40     ` [PATCH v3 6.12] " Michael Zhivich
2025-07-23 13:41     ` [PATCH v3 6.6] " Michael Zhivich
2025-07-23 13:41     ` Michael Zhivich
2025-07-23 13:42     ` Michael Zhivich
2025-07-23 13:42     ` Michael Zhivich
2025-07-23 13:45     ` [PATCH v3 5.10] " Michael Zhivich
2025-07-23 13:45     ` [PATCH v3 5.15] " Michael Zhivich
2025-07-23 13:45     ` [PATCH v3 6.1] " Michael Zhivich
     [not found]     ` <PH0PR17MB4639467A94DEC056F2F46519B95FA@PH0PR17MB4639.namprd17.prod.outlook.com>
2025-07-29 14:38       ` [PATCH v2] " Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).