On Tue, 2025-07-15 at 14:37 +0200, Borislav Petkov wrote:
From: "Borislav Petkov (AMD)" bp@alien8.de
Commit d8010d4ba43e9f790925375a7de100604a5e2dba upstream.
Add the required features detection glue to bugs.c et all in order to support the TSA mitigation.
[...]
+static bool amd_check_tsa_microcode(void) +{
- struct cpuinfo_x86 *c = &boot_cpu_data;
- union zen_patch_rev p;
- u32 min_rev = 0;
- p.ext_fam = c->x86 - 0xf;
- p.model = c->x86_model;
- p.ext_model = c->x86_model >> 4;
- p.stepping = c->x86_stepping;
[...]
p is not fully initialised, so this only works with CONFIG_INIT_STACK_ALL_ZERO enabled.
We need to either do:
memset(&p, 0, sizeof(p));
before assigning to individual fields, or get rid of the union and just do:
u32 ucode_rev;
ucode_rev = (c->x86 - 0xf) << 24 | (c->x86_model & 0xf) << 12 | (c->x86_model >> 4) << 20 | ((c->x86_stepping & 0xf) << 8);
Ben.