On Tue, 26 Jun 2018 11:35:40 +0200 Thomas Huth <[email protected]> wrote:
> The rom_ptr() function allows direct access to the ROM blobs that we > load during startup. However, there are currently no checks for the > size of the accesses, so it's currently possible to crash QEMU for > example with: > > $ echo "Insane in the mainframe" > /tmp/test.txt > $ s390x-softmmu/qemu-system-s390x -kernel /tmp/test.txt -append xyz > Segmentation fault (core dumped) > $ s390x-softmmu/qemu-system-s390x -kernel /tmp/test.txt -initrd /tmp/test.txt > Segmentation fault (core dumped) > $ echo -n HdrS > /tmp/hdr.txt > $ sparc64-softmmu/qemu-system-sparc64 -kernel /tmp/hdr.txt -initrd > /tmp/hdr.txt > Segmentation fault (core dumped) > > We need a possibility to check the size of the ROM area that we want > to access, thus let's add a size parameter to the rom_ptr() function > to avoid these problems. > > Acked-by: Christian Borntraeger <[email protected]> > Signed-off-by: Thomas Huth <[email protected]> > --- > v4: > - Rebase (two more spots were using rom_ptr now) > - Remove INITRD_PARM_SIZE since it's unused now > > hw/core/loader.c | 10 +++++----- > hw/mips/mips_malta.c | 6 ++++-- > hw/s390x/ipl.c | 18 ++++++++++++------ > hw/sparc/sun4m.c | 4 ++-- > hw/sparc64/sun4u.c | 4 ++-- > include/hw/loader.h | 2 +- > target/arm/cpu.c | 2 +- > 7 files changed, 27 insertions(+), 19 deletions(-) Thanks, applied.
