qemu-patch-raspberry4/hw/mips
Thomas Huth 0f0f8b611e loader: Check access size when calling rom_ptr() to avoid crashes
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 <borntraeger@de.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1530005740-25254-1-git-send-email-thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2018-07-02 10:37:38 +02:00
..
addr.c mips: Add KVM T&E segment support for TCG 2017-08-02 22:18:06 +01:00
boston.c hw/mips/boston: don't make flash region 'nomigrate' 2018-06-27 20:10:54 +02:00
cps.c mips: malta/boston: replace cpu_model with cpu_type 2017-10-27 16:04:28 +02:00
gt64xxx_pci.c Replace all occurances of __FUNCTION__ with __func__ 2018-01-22 09:46:18 +01:00
Makefile.objs mips: move hw/mips/cputimer.c to target/mips/ 2017-09-21 13:24:34 +01:00
mips_fulong2e.c hw/isa/vt82c686: Add the TYPE_VT82C686B_SUPERIO 2018-03-12 16:12:49 +01:00
mips_int.c mips: use MIPSCPU instead of CPUMIPSState 2016-05-19 16:42:27 +02:00
mips_jazz.c hw/mips/jazz: create ESP device directly via qdev 2018-06-28 19:05:35 +02:00
mips_malta.c loader: Check access size when calling rom_ptr() to avoid crashes 2018-07-02 10:37:38 +02:00
mips_mipssim.c Change references to serial_hds[] to serial_hd() 2018-04-26 13:57:00 +01:00
mips_r4k.c hw: Do not include "sysemu/block-backend.h" if it is not necessary 2018-06-01 14:15:10 +02:00