[OSS-Fuzz] Issue 29224 rtl8139: Stack-overflow in rtlNUMBER_transmit_one
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
=== Reproducer ===
cat << EOF | ../build/
-nodefaults -device rtl8139,netdev=net0 \
-netdev user,id=net0 -display none -qtest stdio
outl 0xcf8 0x80000804
outb 0xcfc 0x26
outl 0xcf8 0x80000817
outb 0xcfc 0xff
write 0x1 0x1 0x42
write 0x5 0x1 0x42
write 0x9 0x1 0x42
write 0xd 0x1 0x42
write 0xff000044 0x4 0x11
write 0xff000037 0x1 0x1c
writel 0xff000030 0xff000000
write 0xff000040 0x4 0x100006
write 0xff000010 0x4 0x01020
EOF
=== Stack Trace ===
==2819215==ERROR: AddressSanitizer: stack-overflow on address 0x7ffd2c714040 (pc 0x5639b3a933d9 bp 0x7ffd2c716210 sp 0x7ffd2c714040 T0)
#0 rtl8139_
#1 rtl8139_transmit /src/qemu/
#2 rtl8139_
#3 rtl8139_io_writel /src/qemu/
#4 rtl8139_
#5 memory_
#6 access_
#7 memory_
#8 flatview_
#9 flatview_write /src/qemu/
#10 address_space_write /src/qemu/
#11 address_space_rw /src/qemu/
#12 dma_memory_
#13 dma_memory_rw /src/qemu/
#14 pci_dma_rw /src/qemu/
#15 pci_dma_write /src/qemu/
#16 rtl8139_
#17 rtl8139_do_receive /src/qemu/
#18 rtl8139_
#19 rtl8139_
#20 rtl8139_transmit /src/qemu/
#21 rtl8139_
#22 rtl8139_io_writel /src/qemu/
#23 rtl8139_
#24 memory_
#25 access_
#26 memory_
#27 flatview_
#28 flatview_write /src/qemu/
#29 address_space_write /src/qemu/
#30 address_space_rw /src/qemu/
#31 dma_memory_
#32 dma_memory_rw /src/qemu/
#33 pci_dma_rw /src/qemu/
#34 pci_dma_write /src/qemu/
#35 rtl8139_
#36 rtl8139_do_receive /src/qemu/
#37 rtl8139_
Repeat until we run out of stack
tags: | added: fuzzer |
A more concise version and corresponding notes. Might help :)
-- [ Reproducer
cat << EOF | ../build/ qemu-system- i386 -machine q35 \
-nodefaults -device rtl8139,netdev=net0 \
-netdev user,id=net0 -display none -qtest stdio
outl 0xcf8 0x80000804
outb 0xcfc 0x06
outl 0xcf8 0x80000817
outb 0xcfc 0xff
write 0xff000037 0x1 0x0c
writel 0xff000030 0xff000010
write 0xff000040 0x4 0x100006
write 0xff000044 0x4 0x01
write 0xff000010 0x4 0x01
EOF
-- [ Notes
/* Make the MMIO region start from 0xff000000 */
outl 0xcf8 0x80000817
outb 0xcfc 0xff
/*Command Register: enable receiver and transmitter*/
write 0xff000037 0x1 0x0c
/* set Receive (Rx) Buffer Start Address at 0xff000010 */
/* Note: 0xff000010 - 0xff000000 = 0x10 is the offset of TSD0*/
writel 0xff000030 0xff000010
/* TXRR, Tx Retry Count = 1 */
/* set transmit mode into the loopback */
write 0xff000040 0x4 0x100006
/* Receive Configuration Register: Accept All Packets */
write 0xff000044 0x4 0x01
/* TSD0: set Descriptor Size to 1 and trigger a tranfer*/
write 0xff000010 0x4 0x01