aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-06-02 15:25:00 +0200
committerMichael S. Tsirkin <mst@redhat.com>2014-06-18 21:10:27 +0300
commit2d9c2725f7bd08ffaf824b8c823f1423258ec78d (patch)
treef3a12064129e05d108ded48dceeb110307c3b802
parenta790f4ecc9ac54769f483efc00d8e91f31bca14d (diff)
vl.c: daemonize before guest memory allocation
memory allocated for guest before QEMU is daemonized and then mapped later in guest's address space after it is daemonized, leads to EPT violation and QEMU aborts. To avoid this and similar issues switch to daemonized mode early before applying/processing other options. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--vl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index 9ce65fc3dd..16418ecf8c 100644
--- a/vl.c
+++ b/vl.c
@@ -3965,6 +3965,8 @@ int main(int argc, char **argv, char **envp)
}
loc_set_none();
+ os_daemonize();
+
if (qemu_init_main_loop()) {
fprintf(stderr, "qemu_init_main_loop failed\n");
exit(1);
@@ -4206,8 +4208,6 @@ int main(int argc, char **argv, char **envp)
}
#endif
- os_daemonize();
-
if (pid_file && qemu_create_pidfile(pid_file) != 0) {
os_pidfile_error();
exit(1);