]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
fuzz: check the MR in the DMA callback
authorAlexander Bulekov <alxndr@bu.edu>
Thu, 29 Oct 2020 17:28:59 +0000 (13:28 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 3 Nov 2020 18:17:27 +0000 (13:17 -0500)
We should be checking that the device is trying to read from RAM, before
filling the region with data. Otherwise, we will try to populate
nonsensical addresses in RAM for callbacks on PIO/MMIO reads. We did
this originally, however the final version I sent had the line commented
out..

Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Message-Id: <20201029172901.534442-3-alxndr@bu.edu>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tests/qtest/fuzz/generic_fuzz.c

index 3e2d50feaaa82899832f928db207c88389d6b16a..3a5dbc3ce2a53e762c98a85567067494aced3de4 100644 (file)
@@ -192,7 +192,7 @@ void fuzz_dma_read_cb(size_t addr, size_t len, MemoryRegion *mr, bool is_write)
      */
     if (dma_patterns->len == 0
         || len == 0
-        /* || mr != MACHINE(qdev_get_machine())->ram */
+        || mr != current_machine->ram
         || is_write
         || addr > current_machine->ram_size) {
         return;