]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[romprefix] Use correct size for PMM allocation of image source block
authorMichael Brown <mcb30@ipxe.org>
Tue, 15 Mar 2011 01:52:58 +0000 (01:52 +0000)
committerMichael Brown <mcb30@ipxe.org>
Tue, 15 Mar 2011 02:07:22 +0000 (02:07 +0000)
commit23daab14a66d407db4ea81811bddf9da95cc35e9
tree75ba07a813d050a7035988139b3d76b8f745a6dc
parentc315ae039424ad53c0a6c01c93eb0444ab8bfb37
[romprefix] Use correct size for PMM allocation of image source block

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>
src/arch/i386/prefix/romprefix.S