From patchwork Wed Jul 6 14:09:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 9216423 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 DE99E607D9 for ; Wed, 6 Jul 2016 14:09:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF700288F4 for ; Wed, 6 Jul 2016 14:09:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C43DD288F6; Wed, 6 Jul 2016 14:09:56 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 48EA2288F4 for ; Wed, 6 Jul 2016 14:09:55 +0000 (UTC) Received: from localhost ([::1]:33722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKnWU-0001U3-Bq for patchwork-qemu-devel@patchwork.kernel.org; Wed, 06 Jul 2016 10:09:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKnWB-0001Tk-F2 for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:09:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKnW9-0005qH-7K for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:09:34 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:58117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKnW8-0005pv-UL for qemu-devel@nongnu.org; Wed, 06 Jul 2016 10:09:33 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.84_2) (envelope-from ) id 1bKnW6-0003yK-Nz; Wed, 06 Jul 2016 15:09:30 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 6 Jul 2016 15:09:29 +0100 Message-Id: <1467814169-10631-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH] linux-user: Forget about synchronous signal once it is delivered 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: Riku Voipio , patches@linaro.org Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Commit 655ed67c2a248cf which switched synchronous signals to benig recorded in ts->sync_signal rather than in a queue with every other signal had a bug: we failed to clear the flag indicating that a synchronous signal was pending when we delivered it. This meant that we would take the signal again and again every time the guest made a syscall. (This is a bug introduced in my refactoring of Timothy Baldwin's original code.) Fix this by passing in the struct emulated_sigtable* to handle_pending_signal(), so that we clear the pending flag in the ts->sync_signal struct when handling a synchronous signal. Signed-off-by: Peter Maydell --- Found this when investigating why one of the gcc test suite tests was crashing... linux-user/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/signal.c b/linux-user/signal.c index 9d98045..9a4d894 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -5826,7 +5826,8 @@ long do_rt_sigreturn(CPUArchState *env) #endif -static void handle_pending_signal(CPUArchState *cpu_env, int sig) +static void handle_pending_signal(CPUArchState *cpu_env, int sig, + struct emulated_sigtable *k) { CPUState *cpu = ENV_GET_CPU(cpu_env); abi_ulong handler; @@ -5834,7 +5835,6 @@ static void handle_pending_signal(CPUArchState *cpu_env, int sig) target_sigset_t target_old_set; struct target_sigaction *sa; TaskState *ts = cpu->opaque; - struct emulated_sigtable *k = &ts->sigtab[sig - 1]; trace_user_handle_signal(cpu_env, sig); /* dequeue signal */ @@ -5937,7 +5937,7 @@ void process_pending_signals(CPUArchState *cpu_env) sigact_table[sig - 1]._sa_handler = TARGET_SIG_DFL; } - handle_pending_signal(cpu_env, sig); + handle_pending_signal(cpu_env, sig, &ts->sync_signal); } for (sig = 1; sig <= TARGET_NSIG; sig++) { @@ -5947,7 +5947,7 @@ void process_pending_signals(CPUArchState *cpu_env) if (ts->sigtab[sig - 1].pending && (!sigismember(blocked_set, target_to_host_signal_table[sig]))) { - handle_pending_signal(cpu_env, sig); + handle_pending_signal(cpu_env, sig, &ts->sigtab[sig - 1]); /* Restart scan from the beginning */ sig = 1; }