From 2a13a5487f31bd690cc5cba01657b47f169e8364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ky=C3=B6sti=20M=C3=A4lkki?= Date: Mon, 30 May 2022 13:49:20 +0300 Subject: cpu/x86/smm_module_load: Fix SMM stub params MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is NULL dereference in adjust_apic_id_map() and updating apic_id_to_cpu[] array within SMM stub fails. Initial apic_id_to_cpu[] array may have worked for platforms where APIC IDs are consecutive. Change-Id: Ie59a731bfc883f8a47048b2ceacc66f44aa5b68c Signed-off-by: Kyösti Mälkki Reviewed-on: https://review.coreboot.org/c/coreboot/+/64798 Tested-by: build bot (Jenkins) Reviewed-by: Uwe Poeche Reviewed-by: Arthur Heymans Reviewed-by: Lean Sheng Tan Reviewed-by: Sean Rhodes Reviewed-by: Angel Pons --- src/cpu/x86/smm/smm_module_loader.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/cpu/x86') diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c index 6502a6d5b1..1c32ecd5be 100644 --- a/src/cpu/x86/smm/smm_module_loader.c +++ b/src/cpu/x86/smm/smm_module_loader.c @@ -318,6 +318,8 @@ static int smm_module_setup_stub(const uintptr_t smbase, const size_t smm_size, for (int i = 0; i < params->num_cpus; i++) stub_params->apic_id_to_cpu[i] = i; + /* Allow the initiator to manipulate SMM stub parameters. */ + params->stub_params = stub_params; printk(BIOS_DEBUG, "%s: stack_top = 0x%x\n", __func__, stub_params->stack_top); printk(BIOS_DEBUG, "%s: per cpu stack_size = 0x%x\n", __func__, -- cgit v1.2.3