aboutsummaryrefslogtreecommitdiff
path: root/softmmu
diff options
context:
space:
mode:
authorAlexander Bulekov <alxndr@bu.edu>2020-10-23 11:07:35 -0400
committerThomas Huth <thuth@redhat.com>2020-10-26 09:53:53 +0100
commita3c20e91dea6f7af64d886b05d678839b7b1a14c (patch)
tree67c99697c70256521950b249800338e1da7b4bea /softmmu
parente7d3222e2e07e2a1a0aac979ef1fa5e8ef59f02c (diff)
downloadqemu-a3c20e91dea6f7af64d886b05d678839b7b1a14c.zip
qemu-a3c20e91dea6f7af64d886b05d678839b7b1a14c.tar.gz
qemu-a3c20e91dea6f7af64d886b05d678839b7b1a14c.tar.bz2
fuzz: Add fuzzer callbacks to DMA-read functions
We should be careful to not call any functions besides fuzz_dma_read_cb. Without --enable-fuzzing, fuzz_dma_read_cb is an empty inlined function. Signed-off-by: Alexander Bulekov <alxndr@bu.edu> Reviewed-by: Darren Kenny <darren.kenny@oracle.com> Message-Id: <20201023150746.107063-7-alxndr@bu.edu> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/memory.c1
-rw-r--r--softmmu/physmem.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/softmmu/memory.c b/softmmu/memory.c
index cec0e0f..ee4a6bc 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -1433,6 +1433,7 @@ MemTxResult memory_region_dispatch_read(MemoryRegion *mr,
unsigned size = memop_size(op);
MemTxResult r;
+ fuzz_dma_read_cb(addr, size, mr, false);
if (!memory_region_access_valid(mr, addr, size, false, attrs)) {
*pval = unassigned_mem_read(mr, addr, size);
return MEMTX_DECODE_ERROR;
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index e319fb2..a9adedb 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2832,6 +2832,7 @@ MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,
stn_he_p(buf, l, val);
} else {
/* RAM case */
+ fuzz_dma_read_cb(addr, len, mr, false);
ram_ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);
memcpy(buf, ram_ptr, l);
}
@@ -3192,6 +3193,7 @@ void *address_space_map(AddressSpace *as,
memory_region_ref(mr);
*plen = flatview_extend_translation(fv, addr, len, mr, xlat,
l, is_write, attrs);
+ fuzz_dma_read_cb(addr, *plen, mr, is_write);
ptr = qemu_ram_ptr_length(mr->ram_block, xlat, plen, true);
return ptr;