From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48921) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6J7V-0008Gh-1s for qemu-devel@nongnu.org; Fri, 27 May 2016 10:52:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b6J7S-000557-Og for qemu-devel@nongnu.org; Fri, 27 May 2016 10:52:11 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:57380) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b6J7S-00054x-Hv for qemu-devel@nongnu.org; Fri, 27 May 2016 10:52:10 -0400 From: Peter Maydell Date: Fri, 27 May 2016 15:51:58 +0100 Message-Id: <1464360721-14359-17-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1464360721-14359-1-git-send-email-peter.maydell@linaro.org> References: <1464360721-14359-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH v2 16/19] linux-user: Restart fork() if signals pending List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: patches@linaro.org, Riku Voipio , Timothy Edward Baldwin From: Timothy E Baldwin If there is a signal pending during fork() the signal handler will erroneously be called in both the parent and child, so handle any pending signals first. Signed-off-by: Timothy Edward Baldwin Message-id: 1441497448-32489-20-git-send-email-T.E.Baldwin99@members.leeds.ac.uk Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- linux-user/syscall.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 549f571..7d5f123 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4796,6 +4796,11 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, if ((flags & ~(CSIGNAL | CLONE_NPTL_FLAGS2)) != 0) { return -TARGET_EINVAL; } + + if (block_signals()) { + return -TARGET_ERESTARTSYS; + } + fork_start(); ret = fork(); if (ret == 0) { -- 1.9.1