]> Git Repo - qemu.git/commitdiff
exec: keep ram block across fork when using qtest
authorAlexander Bulekov <[email protected]>
Thu, 20 Feb 2020 04:11:09 +0000 (23:11 -0500)
committerStefan Hajnoczi <[email protected]>
Sat, 22 Feb 2020 08:26:48 +0000 (08:26 +0000)
Ram blocks were marked MADV_DONTFORK breaking fuzzing-tests which
execute each test-input in a forked process.

Signed-off-by: Alexander Bulekov <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Darren Kenny <[email protected]>
Message-id: 20200220041118[email protected]
Signed-off-by: Stefan Hajnoczi <[email protected]>
exec.c

diff --git a/exec.c b/exec.c
index 8e9cc3b47cf0d2dbe731522ab8a7ef6b459451a7..c930040f839c74d2ffbff46aeedc86e37e1319ac 100644 (file)
--- 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"
@@ -2305,8 +2306,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);
     }
 }
This page took 0.031768 seconds and 4 git commands to generate.