The SMBIOS anchor string _SM_ is stored within SeaBIOS to validate an SMBIOS entry point structure. There is the possibility (observed) that this comparison string ends up paragraph aligned and mistakenly found during a search for the real SMBIOS entry point. Ensure it will never end up on a paragraph boundary by storing it at odd alignment.
Signed-off-by: Bruce Rogers brogers@suse.com --- src/fw/biostables.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 50a891b..b8ff86f 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -18,6 +18,9 @@ #include "util.h" // copy_table #include "x86.h" // outb
+// ensure signature cannot be found on paragraph boundary +const char smbios_sig_str[] __aligned(2) VARFSEG = " _SM_"; + struct pir_header *PirAddr VARFSEG;
void @@ -271,7 +274,7 @@ copy_smbios(void *pos) if (SMBiosAddr) return; struct smbios_entry_point *p = pos; - if (memcmp(p->anchor_string, "_SM_", 4)) + if (memcmp(p->anchor_string, smbios_sig_str + 1, 4)) return; if (checksum(pos, 0x10) != 0) return;