]> Git Repo - qemu.git/commitdiff
fuzz: move some DMA hooks
authorAlexander Bulekov <[email protected]>
Mon, 15 Mar 2021 14:05:12 +0000 (10:05 -0400)
committerPaolo Bonzini <[email protected]>
Tue, 16 Mar 2021 18:30:30 +0000 (14:30 -0400)
For the sparse-mem device, we want the fuzzer to populate entire DMA
reads from sparse-mem, rather than hooking into the individual MMIO
memory_region_dispatch_read operations. Otherwise, the fuzzer will treat
each sequential read separately (and populate it with a separate
pattern). Work around this by rearranging some DMA hooks. Since the
fuzzer has it's own logic to skip accidentally writing to MMIO regions,
we can call the DMA cb, outside the flatview_translate loop.

Signed-off-by: Alexander Bulekov <[email protected]>
Reviewed-by: Darren Kenny <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
softmmu/memory.c
softmmu/physmem.c

index 9db47b7db6bf72b9403caf94331a54b3b9eab481..c4730ec47aef021efd6495fda3f0b934a210e6e3 100644 (file)
@@ -1440,7 +1440,6 @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr,
     unsigned size = memop_size(op);
     MemTxResult r;
 
-    fuzz_dma_read_cb(addr, size, mr);
     if (!memory_region_access_valid(mr, addr, size, false, attrs)) {
         *pval = unassigned_mem_read(mr, addr, size);
         return MEMTX_DECODE_ERROR;
index 7e8b0fab89a975c0e2d1511fc3610e020d7e44a5..6a58c867503c22af2fc9982936418b11b57cda0f 100644 (file)
@@ -2831,6 +2831,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
     bool release_lock = false;
     uint8_t *buf = ptr;
 
+    fuzz_dma_read_cb(addr, len, mr);
     for (;;) {
         if (!memory_access_is_direct(mr, false)) {
             /* I/O case */
@@ -2841,7 +2842,6 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
             stn_he_p(buf, l, val);
         } else {
             /* RAM case */
-            fuzz_dma_read_cb(addr, len, mr);
             ram_ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
             memcpy(buf, ram_ptr, l);
         }
This page took 0.032404 seconds and 4 git commands to generate.