]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/bugs: Fix use of possibly uninit value in amd_check_tsa_microcode()
authorMichael Zhivich <mzhivich@akamai.com>
Wed, 23 Jul 2025 13:40:19 +0000 (09:40 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Aug 2025 08:48:44 +0000 (09:48 +0100)
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.

This is a stable-only fix.

Cc: <stable@vger.kernel.org>
Signed-off-by: Michael Zhivich <mzhivich@akamai.com>
Fixes: 7a0395f6607a5 ("x86/bugs: Add a Transient Scheduler Attacks mitigation")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/amd.c

index efd42ee9d1cc61e24d4ea41e5284cab63bd924b0..4810271302d0c93d70873bc1d4cebc94ab971370 100644 (file)
@@ -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)) {