Hello Alex, +-- On Tue, 12 May 2020, Alexander Bulekov wrote --+ | ==20527==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x7f79f968a5e0 at pc 0x55b6bb84ce28 bp 0x7ffcbca04eb0 sp 0x7ffcbca04ea8 | READ of size 8 at 0x7f79f968a5e0 thread T0 | | #0 0x55fbeb2bdafc in megasas_lookup_frame /home/alxndr/Development/qemu-bugs/qemu2/qemu/hw/scsi/megasas.c:449:30 | #1 0x55fbeb27caa9 in megasas_handle_abort /home/alxndr/Development/qemu-bugs/qemu2/qemu/hw/scsi/megasas.c:1904:17 | #2 0x55fbeb26cb77 in megasas_handle_frame /home/alxndr/Development/qemu-bugs/qemu2/qemu/hw/scsi/megasas.c:1961:24 | #3 0x55fbeb267b78 in megasas_mmio_write /home/alxndr/Development/qemu-bugs/qemu2/qemu/hw/scsi/megasas.c:2122:9 | #4 0x55fbe90b117b in memory_region_write_accessor /home/alxndr/Development/qemu-bugs/qemu2/qemu/memory.c:496:5 | #5 0x55fbe90b05e4 in access_with_adjusted_size /home/alxndr/Development/qemu-bugs/qemu2/qemu/memory.c:557:18 | #6 0x55fbe90ae177 in memory_region_dispatch_write /home/alxndr/Development/qemu-bugs/qemu2/qemu/memory.c:1488:16 | #7 0x55fbe8d97325 in flatview_write_continue /home/alxndr/Development/qemu-bugs/qemu2/qemu/exec.c:3174:23 | | Fixed reproducer (tested on qemu 5.0 built with ASAN with these patches): | | cat << EOF | qemu-system-i386 -qtest stdio -nographic -monitor none \ | -serial none -M q35 -device megasas -device scsi-cd,drive=null0 \ | -blockdev driver=null-co,read-zeroes=on,node-name=null0 -nographic | outl 0xcf8 0x80001814 | outl 0xcfc 0xc021 | outl 0xcf8 0x80001818 | outl 0xcf8 0x80001804 | outw 0xcfc 0x7 | outl 0xcf8 0x80001810 | outl 0xcfc 0xe10c0000 | outl 0xcf8 0x8000f810 | write 0x0 0x18 0x060017e1ff00f8ffffffff60efffffffffffffffffffffff | write 0xff00 0x1 0x06 | write 0xc021e10c0040 0x81 0x755e08ff0000845e08ff0000935e08ff0000a25e08ff0000b15e08ff0000c05e08ff0000cf5e08ff0000de5e08ff0000ed5e08ff0000fc5e08ff00000b5e08ff00001a5e08ff0000295e08ff0000385e08ff0000475e08ff0000565e08ff0000655e08ff0000745e08ff0000835e08ff0000925e08ff0000a15e08ff0000b05e08 | -M pc-q35-5.0 -no-shutdown -M q35 -device megasas -device scsi-cd,drive=null0 -blockdev driver=null-co,read-zeroes=on,node-name=null0 -nographic
Thanks much for this, will try it. Thank you. -- Prasad J Pandit / Red Hat Product Security Team 8685 545E B54C 486B C6EB 271E E285 8B5A F050 DE8D