summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cpu/x86/smm/smm_module_loader.c6
-rw-r--r--src/cpu/x86/smm/smm_module_loaderv2.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/src/cpu/x86/smm/smm_module_loader.c b/src/cpu/x86/smm/smm_module_loader.c
index fc1e1b3062..876fde6733 100644
--- a/src/cpu/x86/smm/smm_module_loader.c
+++ b/src/cpu/x86/smm/smm_module_loader.c
@@ -209,6 +209,12 @@ static int smm_module_setup_stub(void *smbase, size_t smm_size,
smm_stub_size = rmodule_memory_size(&smm_stub);
stub_entry_offset = rmodule_entry_offset(&smm_stub);
+ if (smm_stub_size > params->per_cpu_save_state_size) {
+ printk(BIOS_ERR, "SMM Module: SMM stub size larger than save state size\n");
+ printk(BIOS_ERR, "SMM Module: Staggered entry points will overlap stub\n");
+ return -1;
+ }
+
/* Assume the stub is always small enough to live within upper half of
* SMRAM region after the save state space has been allocated. */
smm_stub_loc = &base[SMM_ENTRY_OFFSET];
diff --git a/src/cpu/x86/smm/smm_module_loaderv2.c b/src/cpu/x86/smm/smm_module_loaderv2.c
index 22f336ec8d..3fa58717d8 100644
--- a/src/cpu/x86/smm/smm_module_loaderv2.c
+++ b/src/cpu/x86/smm/smm_module_loaderv2.c
@@ -134,6 +134,12 @@ static int smm_create_map(uintptr_t smbase, unsigned int num_cpus,
return 0;
}
+ if (stub_size > ss_size) {
+ printk(BIOS_ERR, "%s: Save state larger than SMM stub size\n", __func__);
+ printk(BIOS_ERR, " Decrease stub size or increase the size allocated for the save state\n");
+ return 0;
+ }
+
for (i = 0; i < num_cpus; i++) {
cpus[i].smbase = base;
cpus[i].entry = base + smm_entry_offset;