Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[romprefix] Avoid unaligned accesses within ROM headers
Ensure that all headers (PCI, UNDI, PnP, iPXE) are aligned to at least
four bytes, so that all accesses to header fields will be correctly
aligned even when reading directly from the expansion ROM BAR.

Reported-by: Peter von Konigsmark <peter@exablaze.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
  • Loading branch information
mcb30 committed Aug 30, 2017
1 parent 8b104d8 commit 75acb3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/arch/x86/prefix/mromprefix.S
Expand Up @@ -492,6 +492,7 @@ mromheader:
.word 0
.size mromheader, . - mromheader

.align 4
mpciheader:
.ascii "PCIR" /* Signature */
.word pci_vendor_id /* Vendor identification */
Expand Down
3 changes: 3 additions & 0 deletions src/arch/x86/prefix/romprefix.S
Expand Up @@ -88,6 +88,7 @@ checksum:
.previous

.ifeqs BUSTYPE, "PCIR"
.align 4
pciheader:
.ascii "PCIR" /* Signature */
.word pci_vendor_id /* Vendor identification */
Expand Down Expand Up @@ -183,6 +184,7 @@ prodstr_pci_id:

.globl undiheader
.weak undiloader
.align 4
undiheader:
.ascii "UNDI" /* Signature */
.byte undiheader_len /* Length of structure */
Expand All @@ -197,6 +199,7 @@ undiheader:
.equ undiheader_len, . - undiheader
.size undiheader, . - undiheader

.align 4
ipxeheader:
.ascii "iPXE" /* Signature */
.byte ipxeheader_len /* Length of structure */
Expand Down

0 comments on commit 75acb3c

Please sign in to comment.