From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55296) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxIo-00020w-Qb for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WwxIj-0002d7-CK for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50437) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WwxIj-0002cu-5D for qemu-devel@nongnu.org; Tue, 17 Jun 2014 13:36:05 -0400 Date: Tue, 17 Jun 2014 20:36:27 +0300 From: "Michael S. Tsirkin" Message-ID: <1403021756-15960-5-git-send-email-mst@redhat.com> References: <1403021756-15960-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1403021756-15960-1-git-send-email-mst@redhat.com> Subject: [Qemu-devel] [PULL 004/103] vl.c: daemonize before guest memory allocation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Anthony Liguori , Igor Mammedov From: Igor Mammedov 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 Acked-by: Peter Crosthwaite Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- vl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 47d4a11..f6f9ec5 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); -- MST