瀏覽代碼

[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>
tags/v1.20.1
Michael Brown 7 年之前
父節點
當前提交
75acb3c775
共有 2 個文件被更改,包括 4 次插入0 次删除
  1. 1
    0
      src/arch/x86/prefix/mromprefix.S
  2. 3
    0
      src/arch/x86/prefix/romprefix.S

+ 1
- 0
src/arch/x86/prefix/mromprefix.S 查看文件

@@ -492,6 +492,7 @@ mromheader:
492 492
 	.word	0
493 493
 	.size	mromheader, . - mromheader
494 494
 
495
+	.align	4
495 496
 mpciheader:
496 497
 	.ascii	"PCIR"			/* Signature */
497 498
 	.word	pci_vendor_id		/* Vendor identification */

+ 3
- 0
src/arch/x86/prefix/romprefix.S 查看文件

@@ -88,6 +88,7 @@ checksum:
88 88
 	.previous
89 89
 
90 90
 .ifeqs	BUSTYPE, "PCIR"
91
+	.align	4
91 92
 pciheader:
92 93
 	.ascii	"PCIR"			/* Signature */
93 94
 	.word	pci_vendor_id		/* Vendor identification */ 
@@ -183,6 +184,7 @@ prodstr_pci_id:
183 184
 
184 185
 	.globl	undiheader	
185 186
 	.weak	undiloader
187
+	.align	4
186 188
 undiheader:
187 189
 	.ascii	"UNDI"			/* Signature */
188 190
 	.byte	undiheader_len		/* Length of structure */
@@ -197,6 +199,7 @@ undiheader:
197 199
 	.equ undiheader_len, . - undiheader
198 200
 	.size undiheader, . - undiheader
199 201
 
202
+	.align	4
200 203
 ipxeheader:
201 204
 	.ascii	"iPXE"			/* Signature */
202 205
 	.byte	ipxeheader_len		/* Length of structure */

Loading…
取消
儲存