[SeaBIOS] [PATCH] Reject non-compliant PCI option ROMs
David Woodhouse
dwmw2 at infradead.org
Tue Jan 29 16:57:46 CET 2013
cf. http://lists.gnu.org/archive/html/qemu-devel/2013-01/msg03650.html
Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
diff --git a/src/Kconfig b/src/Kconfig
index f35b0f5..e49dd82 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -293,6 +293,13 @@ menu "BIOS interfaces"
default y
help
Support finding and running option roms during POST.
+ config PERMIT_UNALIGNED_PCIROM
+ bool "Allow broken PCI option ROMs with unaligned PCIR table"
+ default n
+ help
+ Support initialising PCI ROMs which violate the spec by having
+ their PCI information at an unaligned offset, and which may not
+ be accepted by other firmwares.
config OPTIONROMS_DEPLOYED
depends on OPTIONROMS
bool "Option roms are already at 0xc0000-0xf0000"
diff --git a/src/optionroms.c b/src/optionroms.c
index c9e7d7b..99c4135 100644
--- a/src/optionroms.c
+++ b/src/optionroms.c
@@ -107,6 +107,8 @@ static struct pci_data *
get_pci_rom(struct rom_header *rom)
{
struct pci_data *pd = (void*)((u32)rom + rom->pcioffset);
+ if ((rom->pcioffset & 3) && !CONFIG_PERMIT_UNALIGNED_PCIROM)
+ return NULL;
if (pd->signature != PCI_ROM_SIGNATURE)
return NULL;
return pd;
--
dwmw2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6171 bytes
Desc: not available
URL: <http://www.seabios.org/pipermail/seabios/attachments/20130129/28bc09f4/attachment.bin>
More information about the SeaBIOS
mailing list