[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 12/20] exec: keep ram block across fork when using qtest
From: |
Bulekov, Alexander |
Subject: |
[PATCH v7 12/20] exec: keep ram block across fork when using qtest |
Date: |
Mon, 20 Jan 2020 05:54:59 +0000 |
Ram blocks were marked MADV_DONTFORK breaking fuzzing-tests which
execute each test-input in a forked process.
Signed-off-by: Alexander Bulekov <address@hidden>
---
exec.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/exec.c b/exec.c
index d4b769d0d4..99368f175b 100644
--- a/exec.c
+++ b/exec.c
@@ -35,6 +35,7 @@
#include "sysemu/kvm.h"
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
+#include "sysemu/qtest.h"
#include "qemu/timer.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
@@ -2306,8 +2307,15 @@ static void ram_block_add(RAMBlock *new_block, Error
**errp, bool shared)
if (new_block->host) {
qemu_ram_setup_dump(new_block->host, new_block->max_length);
qemu_madvise(new_block->host, new_block->max_length,
QEMU_MADV_HUGEPAGE);
- /* MADV_DONTFORK is also needed by KVM in absence of synchronous MMU */
- qemu_madvise(new_block->host, new_block->max_length,
QEMU_MADV_DONTFORK);
+ /*
+ * MADV_DONTFORK is also needed by KVM in absence of synchronous MMU
+ * Configure it unless the machine is a qtest server, in which case
+ * KVM is not used and it may be forked (eg for fuzzing purposes).
+ */
+ if (!qtest_enabled()) {
+ qemu_madvise(new_block->host, new_block->max_length,
+ QEMU_MADV_DONTFORK);
+ }
ram_block_notify_add(new_block->host, new_block->max_length);
}
}
--
2.23.0
- [PATCH v7 05/20] libqtest: add a layer of abstraction to send/recv, (continued)
- [PATCH v7 05/20] libqtest: add a layer of abstraction to send/recv, Bulekov, Alexander, 2020/01/20
- [PATCH v7 06/20] module: check module wasn't already initialized, Bulekov, Alexander, 2020/01/20
- [PATCH v7 07/20] qtest: add in-process incoming command handler, Bulekov, Alexander, 2020/01/20
- [PATCH v7 08/20] libqos: rename i2c_send and i2c_recv, Bulekov, Alexander, 2020/01/20
- [PATCH v7 08/20] libqos: split qos-test and libqos makefile vars, Bulekov, Alexander, 2020/01/20
- [PATCH v7 09/20] libqos: split qos-test and libqos makefile vars, Bulekov, Alexander, 2020/01/20
- [PATCH v7 09/20] libqos: move useful qos-test funcs to qos_external, Bulekov, Alexander, 2020/01/20
- [PATCH v7 10/20] libqtest: make bufwrite rely on the TransportOps, Bulekov, Alexander, 2020/01/20
- [PATCH v7 10/20] libqos: move useful qos-test funcs to qos_external, Bulekov, Alexander, 2020/01/20
- [PATCH v7 11/20] fuzz: add fuzzer skeleton, Bulekov, Alexander, 2020/01/20
- [PATCH v7 12/20] exec: keep ram block across fork when using qtest,
Bulekov, Alexander <=
- [PATCH v7 13/20] fuzz: support for fork-based fuzzing., Bulekov, Alexander, 2020/01/20
- [PATCH v7 14/20] fuzz: add support for qos-assisted fuzz targets, Bulekov, Alexander, 2020/01/20
- [PATCH v7 15/20] fuzz: add target/fuzz makefile rules, Bulekov, Alexander, 2020/01/20
- [PATCH v7 17/20] fuzz: add documentation to docs/devel/, Bulekov, Alexander, 2020/01/20
- [PATCH v7 16/20] fuzz: add configure flag --enable-fuzzing, Bulekov, Alexander, 2020/01/20
- [PATCH v7 18/20] fuzz: add virtio-net fuzz target, Bulekov, Alexander, 2020/01/20
- [PATCH v7 17/20] fuzz: add i440fx fuzz targets, Bulekov, Alexander, 2020/01/20