* [PATCH] fuzz: check machine, before PC-specific code
@ 2021-03-14 23:10 Alexander Bulekov
2021-03-14 23:13 ` Alexander Bulekov
2021-03-14 23:15 ` no-reply
0 siblings, 2 replies; 5+ messages in thread
From: Alexander Bulekov @ 2021-03-14 23:10 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Thomas Huth, Alexander Bulekov, f4bug,
darren.kenny, Bandan Das, Stefan Hajnoczi, Paolo Bonzini,
Philippe Mathieu-Daudé
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é <philmd@redhat.com>
Signed-off-by: Alexander Bulekov <alxndr@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)
+ {
+ 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fuzz: check machine, before PC-specific code
2021-03-14 23:10 [PATCH] fuzz: check machine, before PC-specific code Alexander Bulekov
@ 2021-03-14 23:13 ` Alexander Bulekov
2021-03-14 23:31 ` Philippe Mathieu-Daudé
2021-03-14 23:15 ` no-reply
1 sibling, 1 reply; 5+ messages in thread
From: Alexander Bulekov @ 2021-03-14 23:13 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Thomas Huth, f4bug, darren.kenny, Bandan Das,
Stefan Hajnoczi, Paolo Bonzini, Philippe Mathieu-Daudé
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é <philmd@redhat.com>
> Signed-off-by: Alexander Bulekov <alxndr@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
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fuzz: check machine, before PC-specific code
2021-03-14 23:10 [PATCH] fuzz: check machine, before PC-specific code Alexander Bulekov
2021-03-14 23:13 ` Alexander Bulekov
@ 2021-03-14 23:15 ` no-reply
1 sibling, 0 replies; 5+ messages in thread
From: no-reply @ 2021-03-14 23:15 UTC (permalink / raw)
To: alxndr
Cc: lvivier, thuth, darren.kenny, qemu-devel, f4bug, alxndr, bsd,
stefanha, pbonzini, philmd
Patchew URL: https://patchew.org/QEMU/20210314231015.29166-1-alxndr@bu.edu/
Hi,
This series seems to have some coding style problems. See output below for
more information:
Type: series
Message-id: 20210314231015.29166-1-alxndr@bu.edu
Subject: [PATCH] fuzz: check machine, before PC-specific code
=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===
Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/20210314231015.29166-1-alxndr@bu.edu -> patchew/20210314231015.29166-1-alxndr@bu.edu
Switched to a new branch 'test'
bb8e08d fuzz: check machine, before PC-specific code
=== OUTPUT BEGIN ===
ERROR: "foo* bar" should be "foo *bar"
#25: FILE: tests/qtest/fuzz/generic_fuzz.c:787:
+ const char* machine_type;
ERROR: space required before the open parenthesis '('
#37: FILE: tests/qtest/fuzz/generic_fuzz.c:832:
+ if(fuzzable_pci_devices->len && strstr(machine_type, "pc") == machine_type)
total: 2 errors, 0 warnings, 23 lines checked
Commit bb8e08d89398 (fuzz: check machine, before PC-specific code) has style problems, please review. If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
=== OUTPUT END ===
Test command exited with code: 1
The full log is available at
http://patchew.org/logs/20210314231015.29166-1-alxndr@bu.edu/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fuzz: check machine, before PC-specific code
2021-03-14 23:13 ` Alexander Bulekov
@ 2021-03-14 23:31 ` Philippe Mathieu-Daudé
2021-03-15 1:53 ` Alexander Bulekov
0 siblings, 1 reply; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-14 23:31 UTC (permalink / raw)
To: Alexander Bulekov, qemu-devel
Cc: Laurent Vivier, Thomas Huth, darren.kenny, Bandan Das,
Stefan Hajnoczi, Paolo Bonzini, Philippe Mathieu-Daudé
On 3/15/21 12:13 AM, Alexander Bulekov wrote:
> 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é <philmd@redhat.com>
>> Signed-off-by: Alexander Bulekov <alxndr@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..
This doesn't scale with tests/qtest/libqos/pci-spapr.h :(
Maybe use the QOSOps structures?
> -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
>>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fuzz: check machine, before PC-specific code
2021-03-14 23:31 ` Philippe Mathieu-Daudé
@ 2021-03-15 1:53 ` Alexander Bulekov
0 siblings, 0 replies; 5+ messages in thread
From: Alexander Bulekov @ 2021-03-15 1:53 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Laurent Vivier, Thomas Huth, qemu-devel, darren.kenny,
Bandan Das, Stefan Hajnoczi, Paolo Bonzini,
Philippe Mathieu-Daudé
On 210315 0031, Philippe Mathieu-Daudé wrote:
> On 3/15/21 12:13 AM, Alexander Bulekov wrote:
> > 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é <philmd@redhat.com>
> >> Signed-off-by: Alexander Bulekov <alxndr@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..
>
> This doesn't scale with tests/qtest/libqos/pci-spapr.h :(
True - though the existing code wouldn't work for that anyway.
>
> Maybe use the QOSOps structures?
>
> > -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
> >>
> >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-03-15 1:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-14 23:10 [PATCH] fuzz: check machine, before PC-specific code Alexander Bulekov
2021-03-14 23:13 ` Alexander Bulekov
2021-03-14 23:31 ` Philippe Mathieu-Daudé
2021-03-15 1:53 ` Alexander Bulekov
2021-03-14 23:15 ` no-reply
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).