On 210314 1910, Alexander Bulekov wrote: > We enumerate PCI devices on PC machines, but this breaks the fuzzer for > non-PC machines and architectures. Add checks to avoid this. > > Reported-by: Philippe Mathieu-Daudé <phi...@redhat.com> > Signed-off-by: Alexander Bulekov <alx...@bu.edu> > --- > tests/qtest/fuzz/generic_fuzz.c | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c > index ee8c17a04c..d2b74028fe 100644 > --- a/tests/qtest/fuzz/generic_fuzz.c > +++ b/tests/qtest/fuzz/generic_fuzz.c > @@ -784,6 +784,7 @@ static void generic_pre_fuzz(QTestState *s) > MemoryRegion *mr; > QPCIBus *pcibus; > char **result; > + const char* machine_type; > > if (!getenv("QEMU_FUZZ_OBJECTS")) { > usage(); > @@ -827,9 +828,13 @@ static void generic_pre_fuzz(QTestState *s) > exit(1); > } > > - pcibus = qpci_new_pc(s, NULL); > - g_ptr_array_foreach(fuzzable_pci_devices, pci_enum, pcibus); > - qpci_free_pc(pcibus); > + machine_type = object_get_typename(qdev_get_machine()); > + if(fuzzable_pci_devices->len && strstr(machine_type, "pc") == > machine_type) Should at least be "pc-" --^ Maybe there's a more cannonical way to do this.. -Alex
> + { > + pcibus = qpci_new_pc(s, NULL); > + g_ptr_array_foreach(fuzzable_pci_devices, pci_enum, pcibus); > + qpci_free_pc(pcibus); > + } > > counter_shm_init(); > } > -- > 2.27.0 >