From patchwork Tue Jul 19 12:54:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Riku Voipio X-Patchwork-Id: 72304 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp64089qga; Tue, 19 Jul 2016 05:56:59 -0700 (PDT) X-Received: by 10.129.101.137 with SMTP id z131mr29346854ywb.88.1468933019138; Tue, 19 Jul 2016 05:56:59 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id x128si19490075qkd.192.2016.07.19.05.56.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 19 Jul 2016 05:56:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55688 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUa2-000123-MC for patch@linaro.org; Tue, 19 Jul 2016 08:56:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42895) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUXh-0007Zb-UN for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPUXd-0003OC-Re for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:33 -0400 Received: from mail-lf0-x22d.google.com ([2a00:1450:4010:c07::22d]:34447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPUXd-0003O4-JE for qemu-devel@nongnu.org; Tue, 19 Jul 2016 08:54:29 -0400 Received: by mail-lf0-x22d.google.com with SMTP id l69so13412538lfg.1 for ; Tue, 19 Jul 2016 05:54:29 -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=a4YaFo7NhLMFwNd9kLVw2aqKsPStr1usJDx2G8lgVX4=; b=fPKs6NOMoSVhlH16dv4rZh2cSQqLkxLFObmp6GAVneJrwd6oHtfvr9eMd9cH0mXa/B pUS3dNSkqumB4bWQdHSTllAbfW8ukoSGR53Czya66DhxGULI70KTxU8hnaRnvHxfkkXf hiBHz8QroOSwueExI2G4LKyeFPmPU/lMgh3SU= 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=a4YaFo7NhLMFwNd9kLVw2aqKsPStr1usJDx2G8lgVX4=; b=ZVApFJVyLBLfNoCUEDcLsMBi4fjwGvhvq76Mhcs+Ja0kURBiD9Qt9H3PKwXlYvW58t 8+do6owuuF8Hm75+BPvyU3dMQ7c0UggPhCFpVhfWx6AOP6FXGj77HKb144RT8EGrLzo0 QMMEBfEoHRq54zSYrBhAol0pOw60VwQeD6eaWlpz2acvAqFY30QPyJjo1YC94Ls2e9is 8QH8yfiSxWlFHg71Mr4kXccwZdztlRtqnFOvliZ3ATGuv9t/Zpw6Ad80Rp5IIybxemgd M6UA13W8NL6iLml1956mRQYpkW7guUUfm3BA085bbXcE3pd/SSHNhn3XjXswcoF3rqAw Bwag== X-Gm-Message-State: ALyK8tJ8OJaSpVuviPewWTE4CgiMB7DksCmwsZKxw9NMkDIHqTJKU0KErsH1rrOVjZeNrPYY X-Received: by 10.25.131.150 with SMTP id f144mr14395806lfd.53.1468932868801; Tue, 19 Jul 2016 05:54:28 -0700 (PDT) Received: from beaming.home (91-157-170-157.elisa-laajakaista.fi. [91.157.170.157]) by smtp.gmail.com with ESMTPSA id g3sm2248898lfe.14.2016.07.19.05.54.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 05:54:28 -0700 (PDT) From: riku.voipio@linaro.org To: qemu-devel@nongnu.org Date: Tue, 19 Jul 2016 15:54:08 +0300 Message-Id: <31efaef1d9b80b7803e22ef28ffc51df04db60ab.1468932683.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::22d Subject: [Qemu-devel] [PULL 10/16] 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: Peter Maydell Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Signed-off-by: Riku Voipio --- linux-user/signal.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.1.4 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; }