]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
fuzz: fuzz offsets within pio/mmio regions
authorAlexander Bulekov <alxndr@bu.edu>
Thu, 29 Oct 2020 17:29:00 +0000 (13:29 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 3 Nov 2020 18:17:27 +0000 (13:17 -0500)
The code did not add offsets to FlatRange bases, so we did not fuzz
offsets within device MemoryRegions.

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

index 3a5dbc3ce2a53e762c98a85567067494aced3de4..262a963d2e6e4680496b9947ceb41ee9038f4465 100644 (file)
@@ -298,6 +298,11 @@ static bool get_io_address(address_range *result, AddressSpace *as,
     } while (cb_info.index != index && !cb_info.found);
 
     *result = cb_info.result;
+    if (result->size) {
+        offset = offset % result->size;
+        result->addr += offset;
+        result->size -= offset;
+    }
     return cb_info.found;
 }