summaryrefslogtreecommitdiff
path: root/src/cpu/x86/smm/smm_module_loaderv2.c
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2020-11-01 12:37:40 +0100
committerPatrick Georgi <pgeorgi@google.com>2020-11-16 12:07:41 +0000
commitfd8619e665416fe1d7b7b4c1e69a7ceb1ea58ef8 (patch)
tree28176ae51c0199037c0319c51766a51d7a38b1b9 /src/cpu/x86/smm/smm_module_loaderv2.c
parentbf13ef0738a7898b4877491a0aaa95aabf4700b5 (diff)
cpu/x86/smm: Check that the stub size is < save state size
If the stub size would be larger than the save state size, the stagger points would overlap with the stub. The check is placed in the stub placement code. The stub placement code is called twice. Once for the initial SMM relocatation and for the permanent handler in TSEG. So the check is done twice, which is not really needed. Change-Id: I253e1a7112cd8f7496cb1a826311f4dd5ccfc73a Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/47069 Reviewed-by: David Hendricks <david.hendricks@gmail.com> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/cpu/x86/smm/smm_module_loaderv2.c')
-rw-r--r--src/cpu/x86/smm/smm_module_loaderv2.c6
1 files changed, 6 insertions, 0 deletions
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;