Selaa lähdekoodia

[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 8 vuotta sitten
vanhempi
commit
75acb3c775
2 muutettua tiedostoa jossa 4 lisäystä ja 0 poistoa
  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 Näytä tiedosto

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 Näytä tiedosto

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 */

Loading…
Peruuta
Tallenna