浏览代码

[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 6 年前
父节点
当前提交
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
 	.word	0
492
 	.word	0
493
 	.size	mromheader, . - mromheader
493
 	.size	mromheader, . - mromheader
494
 
494
 
495
+	.align	4
495
 mpciheader:
496
 mpciheader:
496
 	.ascii	"PCIR"			/* Signature */
497
 	.ascii	"PCIR"			/* Signature */
497
 	.word	pci_vendor_id		/* Vendor identification */
498
 	.word	pci_vendor_id		/* Vendor identification */

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

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

正在加载...
取消
保存