From patchwork Wed Jun 8 13:30:02 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9164783 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86060604DB for ; Wed, 8 Jun 2016 14:10:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7943C26B4A for ; Wed, 8 Jun 2016 14:10:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E30A28047; Wed, 8 Jun 2016 14:10:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, FSL_HELO_HOME, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E3D326B4A for ; Wed, 8 Jun 2016 14:10:32 +0000 (UTC) Received: from localhost ([::1]:57228 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAeBk-0007UU-2I for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 10:10:32 -0400 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tRkHt4pqIZ6z3S/utvJpR8Jio620wOiTq8etWG5LXyo=; b=XUiFHt3+TICZ79GlTmdkeyVJjdeRQripXWhR/62Dd5qAeV8u0YGYQ/FMH6pONDKW0s NbcCFNA+wgxOdlsUkGoBlB26ITR/BJSZHXDRBPTgfEZiF2x51k55gIpCJVDtNi58rCHz /MWPrIcRnWFv3a2wnJwbwCytVlUnqATz/bfMI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tRkHt4pqIZ6z3S/utvJpR8Jio620wOiTq8etWG5LXyo=; b=AFcMcAsYerM/PPjsbtdwkOy2iYaULvMpU4VqFfw0PyxWma4JU8kE9cCgA/b+oNjSx+ dntfhVlXYqqJPoi/Nwj5p2Q2MIvtIkZylYDii/abcgsgB2aFDdMAf9rX2TppJeqWtcYO QZn84nu4d9jG5d0Sa0bLtBOhE8d5PGbSgcn6M43yGC5hMYquuKrdYIUsBiw1Y58IiTKt XpWwust5Im5oAPidePkkEJeoxOrJ/TaZeQx14U9b8xxNOeiLW8uZh8oX5aFHGGdn0h7T PHkpZ2H26rJ6syBiPQJcQWgsYBoosZeKposnB0bXbv6ymDHDvTgDh6Fy8wnXok8ThIXO hIaA== X-Gm-Message-State: ALyK8tKUvbt3bYvkrbVlL0uPsIx+ngBB5aTjvyzl6v2K9iaI8Ps07tcix3kIjizazrb5TQK9 X-Received: by 10.25.167.201 with SMTP id q192mr4877703lfe.59.1465392652408; Wed, 08 Jun 2016 06:30:52 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id 2sm139854lja.37.2016.06.08.06.30.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:51 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:02 +0300 Message-Id: <7d92d34ee4c7988f5ef6c8a5ed23d2c3e0837253.1465392531.git.riku.voipio@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:4010:c07::231 Subject: [Qemu-devel] [PULL 21/44] linux-user: Restart fork() if signals pending X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Timothy E Baldwin Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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) {