From 71226054f28ad98ab214b56a15899e8f62a7bca8 Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Thu, 1 Jun 2023 15:26:02 +0100 Subject: [PATCH] x86/ucode: Exit early from early_update_cache() if loading not available If for any reason early_microcode_init() concludes that no microcode loading is available, early_update_cache() will fall over a NULL function pointer: (XEN) Xen call trace: (XEN) [] R show_code+0x91/0x18f (XEN) [] F show_execution_state+0x2d/0x1fc (XEN) [] F fatal_trap+0x87/0x19a (XEN) [] F init_idt_traps+0/0x1bd (XEN) [] F early_page_fault+0x8f/0x94 (XEN) [<0000000000000000>] F 0000000000000000 (XEN) [] F arch/x86/cpu/microcode/core.c#early_update_cache+0x11/0x74 (XEN) [] F microcode_init_cache+0x5a/0x5c (XEN) [] F __start_xen+0x1e11/0x27ee (XEN) [] F __high_start+0x94/0xa0 which is actually parse_blob()'s use of ucode_ops.collect_cpu_info. Skip trying to cache anything if microcode loading is unavailable. Fixes: dc380df12acf ("x86/ucode: load microcode earlier on boot CPU") Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- xen/arch/x86/cpu/microcode/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c index cd456c476f..c1033f3bc2 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -789,6 +789,9 @@ int __init microcode_init_cache(unsigned long *module_map, { int rc = 0; + if ( !ucode_ops.apply_microcode ) + return -ENODEV; + if ( ucode_scan ) /* Need to rescan the modules because they might have been relocated */ microcode_scan_module(module_map, mbi); -- 2.39.5