From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37057) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZT-0004MK-Sl for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZO-0005mQ-Ej for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:58 -0400 Received: from mail-lf0-x231.google.com ([2a00:1450:4010:c07::231]:36241) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZO-0005lm-71 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:54 -0400 Received: by mail-lf0-x231.google.com with SMTP id j5so5838739lfb.3 for ; Wed, 08 Jun 2016 06:30:53 -0700 (PDT) From: riku.voipio@linaro.org Date: Wed, 8 Jun 2016 16:30:02 +0300 Message-Id: <7d92d34ee4c7988f5ef6c8a5ed23d2c3e0837253.1465392531.git.riku.voipio@linaro.org> In-Reply-To: References: Subject: [Qemu-devel] [PULL 21/44] 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: Timothy E 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 Signed-off-by: Riku Voipio --- linux-user/syscall.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index c0d086c..a2d591e 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -5437,6 +5437,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) { -- 2.1.4