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: d12145e8454f ("x86/bugs: Add a Transient Scheduler Attacks mitigation") ---
Changes in v3: - separate "fixes" tag for each 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 4785d41558d6..2d71c329b347 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c @@ -563,6 +563,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 (c->x86 == 0x19) { switch (p.ucode_rev >> 8) {