[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC 15/19] fuzz: add fuzz accelerator type
From: |
Oleinik, Alexander |
Subject: |
[Qemu-devel] [RFC 15/19] fuzz: add fuzz accelerator type |
Date: |
Thu, 25 Jul 2019 03:23:57 +0000 |
Signed-off-by: Alexander Oleinik <address@hidden>
---
accel/fuzz.c | 47 +++++++++++++++++++++++++++++++++++++++++++
include/sysemu/fuzz.h | 15 ++++++++++++++
2 files changed, 62 insertions(+)
create mode 100644 accel/fuzz.c
create mode 100644 include/sysemu/fuzz.h
diff --git a/accel/fuzz.c b/accel/fuzz.c
new file mode 100644
index 0000000000..1694cf46e8
--- /dev/null
+++ b/accel/fuzz.c
@@ -0,0 +1,47 @@
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu/module.h"
+#include "qemu/option.h"
+#include "qemu/config-file.h"
+#include "sysemu/accel.h"
+#include "sysemu/fuzz.h"
+#include "sysemu/cpus.h"
+
+
+static void fuzz_setup_post(MachineState *ms, AccelState *accel) {
+}
+
+static int fuzz_init_accel(MachineState *ms)
+{
+ QemuOpts *opts = qemu_opts_create(qemu_find_opts("icount"), NULL, 0,
+ &error_abort);
+ qemu_opt_set(opts, "shift", "0", &error_abort);
+ configure_icount(opts, &error_abort);
+ qemu_opts_del(opts);
+ return 0;
+}
+
+static void fuzz_accel_class_init(ObjectClass *oc, void *data)
+{
+ AccelClass *ac = ACCEL_CLASS(oc);
+ ac->name = "fuzz";
+ ac->init_machine = fuzz_init_accel;
+ ac->setup_post = fuzz_setup_post;
+ ac->allowed = &fuzz_allowed;
+}
+
+#define TYPE_FUZZ_ACCEL ACCEL_CLASS_NAME("fuzz")
+
+static const TypeInfo fuzz_accel_type = {
+ .name = TYPE_FUZZ_ACCEL,
+ .parent = TYPE_ACCEL,
+ .class_init = fuzz_accel_class_init,
+};
+
+static void fuzz_type_init(void)
+{
+ type_register_static(&fuzz_accel_type);
+}
+
+type_init(fuzz_type_init);
+
diff --git a/include/sysemu/fuzz.h b/include/sysemu/fuzz.h
new file mode 100644
index 0000000000..09a2a9ffdf
--- /dev/null
+++ b/include/sysemu/fuzz.h
@@ -0,0 +1,15 @@
+#ifndef FUZZ_H
+#define FUZZ_H
+
+bool fuzz_allowed;
+
+static inline bool fuzz_enabled(void)
+{
+ return fuzz_allowed;
+}
+
+bool fuzz_driver(void);
+
+void fuzz_init(const char *fuzz_chrdev, const char *fuzz_log, Error **errp);
+
+#endif
--
2.20.1
- [Qemu-devel] [RFC 10/19] fuzz: expose real_main (aka regular vl.c:main), (continued)
- [Qemu-devel] [RFC 10/19] fuzz: expose real_main (aka regular vl.c:main), Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 11/19] fuzz: add direct send/receive in qtest client, Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 14/19] fuzz: hard-code a main-loop timeout, Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 13/19] fuzz: add ctrl vq support to virtio-net in libqos, Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 15/19] fuzz: add fuzz accelerator type,
Oleinik, Alexander <=
- [Qemu-devel] [RFC 18/19] fuzz: Add virtio-net tx and ctrl fuzz targets, Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 16/19] fuzz: add general fuzzer entrypoints, Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 17/19] fuzz: add general qtest fuzz target, Oleinik, Alexander, 2019/07/24
- [Qemu-devel] [RFC 19/19] fuzz: Add documentation about the fuzzer to docs/, Oleinik, Alexander, 2019/07/24
- Re: [Qemu-devel] [RFC 00/19] Add virtual device fuzzing support, no-reply, 2019/07/24
- Re: [Qemu-devel] [RFC 00/19] Add virtual device fuzzing support, Stefan Hajnoczi, 2019/07/26