From: Kevin O'Connor Date: Mon, 3 Aug 2015 14:16:39 +0000 (-0400) Subject: mptable: Don't create mptable if it is very large X-Git-Tag: rel-1.9.0~73 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=9ee2e26255661a191b0ff9fa276d545ce59845c2;p=seabios.git mptable: Don't create mptable if it is very large Very large mptable structures can fill up the space in the f-segment and cause other important f-segment allocations to fail. Limit the maximum size of the mptable to prevent this. On QEMU, with the current maximum size of 600 bytes, the mptable will not be created in configurations of ~20 cpus or more. The mptable is rarely used in modern OSes so this should not be a problem. Reported-by: Huaitong Han Signed-off-by: Kevin O'Connor --- diff --git a/src/config.h b/src/config.h index 4bfebe8..6c47f16 100644 --- a/src/config.h +++ b/src/config.h @@ -22,6 +22,8 @@ #define BUILD_MAX_EXTDRIVE 16 // Number of bytes the smbios may be and still live in the f-segment #define BUILD_MAX_SMBIOS_FSEG 600 +// Maximum number of bytes the mptable may be and still be copied to f-segment +#define BUILD_MAX_MPTABLE_FSEG 600 #define BUILD_MODEL_ID 0xFC #define BUILD_SUBMODEL_ID 0x00 diff --git a/src/fw/biostables.c b/src/fw/biostables.c index 450aca2..71a1a0d 100644 --- a/src/fw/biostables.c +++ b/src/fw/biostables.c @@ -54,6 +54,11 @@ copy_mptable(void *pos) return; u32 length = p->length * 16; u16 mpclength = ((struct mptable_config_s *)p->physaddr)->length; + if (length + mpclength > BUILD_MAX_MPTABLE_FSEG) { + dprintf(1, "Skipping MPTABLE copy due to large size (%d bytes)\n" + , length + mpclength); + return; + } // Allocate final memory location. (In theory the config // structure can go in high memory, but Linux kernels before // v2.6.30 crash with that.)