[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/31] fuzz: register predefined generic-fuzz configs
From: |
Thomas Huth |
Subject: |
[PULL 23/31] fuzz: register predefined generic-fuzz configs |
Date: |
Mon, 26 Oct 2020 11:06:24 +0100 |
From: Alexander Bulekov <alxndr@bu.edu>
We call get_generic_fuzz_configs, which fills an array with
predefined {name, args, objects} triples. For each of these, we add a
new FuzzTarget, that uses a small wrapper to set
QEMU_FUZZ_{ARGS,OBJECTS} to the corresponding predefined values.
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20201023150746.107063-16-alxndr@bu.edu>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/qtest/fuzz/generic_fuzz.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/tests/qtest/fuzz/generic_fuzz.c b/tests/qtest/fuzz/generic_fuzz.c
index 592b78ffe2..a8f5864883 100644
--- a/tests/qtest/fuzz/generic_fuzz.c
+++ b/tests/qtest/fuzz/generic_fuzz.c
@@ -26,6 +26,7 @@
#include "hw/qdev-core.h"
#include "hw/pci/pci.h"
#include "hw/boards.h"
+#include "generic_fuzz_configs.h"
/*
* SEPARATOR is used to separate "operations" in the fuzz input
@@ -907,6 +908,17 @@ static GString *generic_fuzz_cmdline(FuzzTarget *t)
return cmd_line;
}
+static GString *generic_fuzz_predefined_config_cmdline(FuzzTarget *t)
+{
+ const generic_fuzz_config *config;
+ g_assert(t->opaque);
+
+ config = t->opaque;
+ setenv("QEMU_FUZZ_ARGS", config->args, 1);
+ setenv("QEMU_FUZZ_OBJECTS", config->objects, 1);
+ return generic_fuzz_cmdline(t);
+}
+
static void register_generic_fuzz_targets(void)
{
fuzz_add_target(&(FuzzTarget){
@@ -917,6 +929,26 @@ static void register_generic_fuzz_targets(void)
.fuzz = generic_fuzz,
.crossover = generic_fuzz_crossover
});
+
+ GString *name;
+ const generic_fuzz_config *config;
+
+ for (int i = 0;
+ i < sizeof(predefined_configs) / sizeof(generic_fuzz_config);
+ i++) {
+ config = predefined_configs + i;
+ name = g_string_new("generic-fuzz");
+ g_string_append_printf(name, "-%s", config->name);
+ fuzz_add_target(&(FuzzTarget){
+ .name = name->str,
+ .description = "Predefined generic-fuzz config.",
+ .get_init_cmdline = generic_fuzz_predefined_config_cmdline,
+ .pre_fuzz = generic_pre_fuzz,
+ .fuzz = generic_fuzz,
+ .crossover = generic_fuzz_crossover,
+ .opaque = (void *)config
+ });
+ }
}
fuzz_target_init(register_generic_fuzz_targets);
--
2.18.2
- [PULL 14/31] fuzz: Add fuzzer callbacks to DMA-read functions, (continued)
- [PULL 14/31] fuzz: Add fuzzer callbacks to DMA-read functions, Thomas Huth, 2020/10/26
- [PULL 19/31] scripts/oss-fuzz: Add crash trace minimization script, Thomas Huth, 2020/10/26
- [PULL 16/31] fuzz: add a DISABLE_PCI op to generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 20/31] fuzz: Add instructions for using generic-fuzz, Thomas Huth, 2020/10/26
- [PULL 21/31] fuzz: add an "opaque" to the FuzzTarget struct, Thomas Huth, 2020/10/26
- [PULL 17/31] fuzz: add a crossover function to generic-fuzzer, Thomas Huth, 2020/10/26
- [PULL 18/31] scripts/oss-fuzz: Add script to reorder a generic-fuzzer trace, Thomas Huth, 2020/10/26
- [PULL 22/31] fuzz: add generic-fuzz configs for oss-fuzz, Thomas Huth, 2020/10/26
- [PULL 24/31] scripts/oss-fuzz: use hardlinks instead of copying, Thomas Huth, 2020/10/26
- [PULL 13/31] fuzz: Declare DMA Read callback function, Thomas Huth, 2020/10/26
- [PULL 23/31] fuzz: register predefined generic-fuzz configs,
Thomas Huth <=
- [PULL 25/31] scripts/oss-fuzz: ignore the generic-fuzz target, Thomas Huth, 2020/10/26
- [PULL 27/31] test/acceptance: Remove the CONTINUOUS_INTEGRATION tags, Thomas Huth, 2020/10/26
- [PULL 26/31] tests/acceptance/ppc_prep_40p: Fix the URL to the NetBSD-4.0 archive, Thomas Huth, 2020/10/26
- [PULL 28/31] tests/acceptance: Enable AVOCADO_ALLOW_UNTRUSTED_CODE in the gitlab-CI, Thomas Huth, 2020/10/26
- [PULL 29/31] test/docker/dockerfiles: Add missing packages for acceptance tests, Thomas Huth, 2020/10/26
- [PULL 30/31] tests/acceptance: Remove unused import, Thomas Huth, 2020/10/26
- [PULL 31/31] tests/acceptance: Use .ppm extention for Portable PixMap files, Thomas Huth, 2020/10/26
- Re: [PULL 00/31] qtests and gitlab-CI/acceptance patches, Peter Maydell, 2020/10/26