From patchwork Wed Jun 8 13:30:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 9164769 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 580FA60572 for ; Wed, 8 Jun 2016 14:01:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4666F24151 for ; Wed, 8 Jun 2016 14:01:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3AFFF265B9; Wed, 8 Jun 2016 14:01:53 +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 9655324151 for ; Wed, 8 Jun 2016 14:01:50 +0000 (UTC) Received: from localhost ([::1]:57173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAe3J-0007hk-P4 for patchwork-qemu-devel@patchwork.kernel.org; Wed, 08 Jun 2016 10:01:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZS-0004LC-Rr for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:31:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAdZN-0005m5-E6 for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:57 -0400 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]:33660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAdZM-0005l5-Oj for qemu-devel@nongnu.org; Wed, 08 Jun 2016 09:30:53 -0400 Received: by mail-lf0-x22b.google.com with SMTP id s64so5902534lfe.0 for ; Wed, 08 Jun 2016 06:30:50 -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=sEz49tfnzaO3TKuyS2LYZjDYM59qbb2GHWvret4WB+Q=; b=UVnSYdC5iRobocc3DJ5KJN3nDzmQs5gmn9NEabBPn2NUT2O1k6yi0VL2EMTZvhEGz3 gCpb+3y5q7rVMe+CtL6M880UWdhGUK6RMH0o5HFCqTntQlY3NKaTEFSysTlJdj/N2Ys5 22tuPt2nbL35rsHKiuxq+Q5TDgpIJJkJlF9iU= 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=sEz49tfnzaO3TKuyS2LYZjDYM59qbb2GHWvret4WB+Q=; b=JS252jadIdaxynPt89iVGUOF9vmGk3MukiUu3Io/nf/2WSd7nV6UT6i+EVWNd6Z3ZZ 1WlW4y0PIHiQqUeZKns+joKXvK1dd+J9uzutpIN3rAFUappou/wtDzzEZ9vtJ4XRFv7T 5o0yXHS+r4ewhavFbPmWhXPXwZZMyLBOnYjKmCvQI9mMVZfn+Mlak19k/LEA4tBJvZno 882VYYz0DHD3XctyAGYDafhfiFFOzFvJ5laq1NR8kpe6cXUJ/2xALY2rKWmTkkXs5WpF UZD+qknICw40bK0WcDi/Z6V6wNJl/0fu/78eqH0xmxMznXU6aeJAz/jsi5F+n5OvAvrs yeqQ== X-Gm-Message-State: ALyK8tJRl0I+Et6Jh9uXemTTS0qb2lXPmsxyxWCv4ZYTmB6/E6vzvmz/BNcrMiSAC6Nftn+V X-Received: by 10.25.22.70 with SMTP id m67mr3743753lfi.25.1465392649783; Wed, 08 Jun 2016 06:30:49 -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.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Jun 2016 06:30:49 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Wed, 8 Jun 2016 16:30:00 +0300 Message-Id: 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::22b Subject: [Qemu-devel] [PULL 19/44] linux-user: Restart exit() if signal 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 Without this a signal could vanish on thread exit. Signed-off-by: Timothy Edward Baldwin Message-id: 1441497448-32489-26-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 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index aa5517c..f3061a9 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6640,8 +6640,12 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1, However in threaded applictions it is used for thread termination, and _exit_group is used for application termination. Do thread termination if we have more then one thread. */ - /* FIXME: This probably breaks if a signal arrives. We should probably - be disabling signals. */ + + if (block_signals()) { + ret = -TARGET_ERESTARTSYS; + break; + } + if (CPU_NEXT(first_cpu)) { TaskState *ts;