iPXE allocates its first PMM block using the image source length, which is rounded up to the nearest 16-byte paragraph. It then copies in data of a length calculated from the ROM size, which is theoretically less than or equal to the image source length, but is rounded up to the nearest 512-byte sector. This can result in copying beyond the end of the allocated PMM block, which can corrupt the PMM data structures (and other essentially arbitrary areas of memory). Fix by rounding up the image source length to the nearest 512-byte sector before using it as the PMM allocation length. Reported-by: Alex Williamson <alex.williamson@redhat.com> Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Reported-by: Itay Gazit <itayg@mellanox.co.il> Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
320 |
|
320 |
|
321 |
|
321 |
|
322 |
|
322 |
|
323 |
|
|
|
|
323 |
|
|
|
324 |
|
|
324 |
|
325 |
|
325 |
|
326 |
|
326 |
|
327 |
|
|
|
||
565 |
|
566 |
|
566 |
|
567 |
|
567 |
|
568 |
|
568 |
|
|
|
|
569 |
|
|
569 |
|
570 |
|
570 |
|
571 |
|
571 |
|
|
|
|
572 |
|
|
572 |
|
573 |
|
573 |
|
|
|
|
574 |
|
|
574 |
|
575 |
|
575 |
|
576 |
|
576 |
|
|
|
577 |
|
|
|
|
577 |
|
|
|
578 |
|
|
578 |
|
579 |
|
579 |
|
580 |
|
580 |
|
581 |
|