Skip to content

Commit 8a9fb51

Browse files
committed
x86/microcode/AMD: Limit Entrysign signature checking to known generations
Limit Entrysign sha256 signature checking to CPUs in the range Zen1-Zen5. X86_BUG cannot be used here because the loading on the BSP happens way too early, before the cpufeatures machinery has been set up. Signed-off-by: Borislav Petkov (AMD) <[email protected]> Link: https://patch.msgid.link/all/[email protected]
1 parent dcb6fa3 commit 8a9fb51

File tree

1 file changed

+19
-1
lines changed
  • arch/x86/kernel/cpu/microcode

1 file changed

+19
-1
lines changed

arch/x86/kernel/cpu/microcode/amd.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,31 @@ static bool need_sha_check(u32 cur_rev)
233233
return true;
234234
}
235235

236+
static bool cpu_has_entrysign(void)
237+
{
238+
unsigned int fam = x86_family(bsp_cpuid_1_eax);
239+
unsigned int model = x86_model(bsp_cpuid_1_eax);
240+
241+
if (fam == 0x17 || fam == 0x19)
242+
return true;
243+
244+
if (fam == 0x1a) {
245+
if (model <= 0x2f ||
246+
(0x40 <= model && model <= 0x4f) ||
247+
(0x60 <= model && model <= 0x6f))
248+
return true;
249+
}
250+
251+
return false;
252+
}
253+
236254
static bool verify_sha256_digest(u32 patch_id, u32 cur_rev, const u8 *data, unsigned int len)
237255
{
238256
struct patch_digest *pd = NULL;
239257
u8 digest[SHA256_DIGEST_SIZE];
240258
int i;
241259

242-
if (x86_family(bsp_cpuid_1_eax) < 0x17)
260+
if (!cpu_has_entrysign())
243261
return true;
244262

245263
if (!need_sha_check(cur_rev))

0 commit comments

Comments
 (0)