[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH v2 05/17] fuzz: Add direct receive function for
From: |
Oleinik, Alexander |
Subject: |
[Qemu-devel] [RFC PATCH v2 05/17] fuzz: Add direct receive function for qtest server |
Date: |
Mon, 5 Aug 2019 07:11:06 +0000 |
The direct receive function qtest_server_recv is directly invoked by the
qtest client, when the server and client exist within the same process.
Signed-off-by: Alexander Oleinik <address@hidden>
---
include/sysemu/qtest.h | 4 ++++
qtest.c | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h
index 5ed09c80b1..a7b7a3081e 100644
--- a/include/sysemu/qtest.h
+++ b/include/sysemu/qtest.h
@@ -26,4 +26,8 @@ bool qtest_driver(void);
void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Error
**errp);
+#ifdef CONFIG_FUZZ
+void qtest_server_recv(GString *inbuf); /* Client sends commands using this */
+#endif
+
#endif
diff --git a/qtest.c b/qtest.c
index c9681dbdf3..427e1e5076 100644
--- a/qtest.c
+++ b/qtest.c
@@ -31,6 +31,9 @@
#ifdef TARGET_PPC64
#include "hw/ppc/spapr_rtas.h"
#endif
+#ifdef CONFIG_FUZZ
+#include "tests/libqtest.h"
+#endif
#define MAX_IRQ 256
@@ -231,10 +234,14 @@ static void GCC_FMT_ATTR(1, 2) qtest_log_send(const char
*fmt, ...)
static void do_qtest_send(CharBackend *chr, const char *str, size_t len)
{
+#ifdef CONFIG_FUZZ
+ qtest_client_recv(str, len);
+#else
qemu_chr_fe_write_all(chr, (uint8_t *)str, len);
if (qtest_log_fp && qtest_opened) {
fprintf(qtest_log_fp, "%s", str);
}
+#endif
}
static void qtest_send(CharBackend *chr, const char *str)
@@ -760,6 +767,7 @@ void qtest_server_init(const char *qtest_chrdev, const char
*qtest_log, Error **
return;
}
+ assert(!qtest_log_fp);
if (qtest_log) {
if (strcmp(qtest_log, "none") != 0) {
qtest_log_fp = fopen(qtest_log, "w+");
@@ -780,3 +788,9 @@ bool qtest_driver(void)
{
return qtest_chr.chr != NULL;
}
+#ifdef CONFIG_FUZZ
+void qtest_server_recv(GString *inbuf)
+{
+ qtest_process_inbuf(NULL, inbuf);
+}
+#endif
--
2.20.1
- [Qemu-devel] [RFC PATCH v2 02/17] fuzz: Add fuzzer configure options, (continued)
- [Qemu-devel] [RFC PATCH v2 02/17] fuzz: Add fuzzer configure options, Oleinik, Alexander, 2019/08/05
- [Qemu-devel] [RFC PATCH v2 03/17] fuzz: Keep memory mapped for fork-based fuzzer, Oleinik, Alexander, 2019/08/05
- [Qemu-devel] [RFC PATCH v2 04/17] fuzz: Skip modules that were already initialized, Oleinik, Alexander, 2019/08/05
- [Qemu-devel] [RFC PATCH v2 05/17] fuzz: Add direct receive function for qtest server,
Oleinik, Alexander <=
- [Qemu-devel] [RFC PATCH v2 06/17] fuzz: Add FUZZ_TARGET module type, Oleinik, Alexander, 2019/08/05
- [Qemu-devel] [RFC PATCH v2 07/17] fuzz: Add ramfile qemu-file type, Oleinik, Alexander, 2019/08/05
- [Qemu-devel] [RFC PATCH v2 09/17] fuzz: hardcode needed objects into i386 target, Oleinik, Alexander, 2019/08/05
- [Qemu-devel] [RFC PATCH v2 08/17] fuzz: Export the qemu_savevm_live_state function, Oleinik, Alexander, 2019/08/05