qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: riku.voipio@linaro.org
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>
Subject: [Qemu-devel] [PULL 10/16] linux-user: Forget about synchronous signal once it is delivered
Date: Tue, 19 Jul 2016 15:54:08 +0300	[thread overview]
Message-ID: <31efaef1d9b80b7803e22ef28ffc51df04db60ab.1468932683.git.riku.voipio@linaro.org> (raw)
In-Reply-To: <cover.1468932683.git.riku.voipio@linaro.org>

From: Peter Maydell <peter.maydell@linaro.org>

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 <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 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;
             }
-- 
2.1.4

  parent reply	other threads:[~2016-07-19 12:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-19 12:53 [Qemu-devel] [PULL 00/16] linux-user before 2.7 hardfreeze riku.voipio
2016-07-19 12:53 ` [Qemu-devel] [PULL 01/16] linux-user: fd_trans_*_data() returns the length riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 02/16] linux-user: fix netlink memory corruption riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 03/16] linux-user: add fd_trans helper in do_recvfrom() riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 04/16] linux-user: convert sockaddr_ll from host to target riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 05/16] linux-user: add nested netlink types riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 06/16] linux-user: Check sigsetsize argument to syscalls riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 07/16] linux-user: Add loop control ioctls riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 08/16] linux-user: Correct type for BLKSSZGET riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 09/16] linux-user: Correct type for LOOP_GET_STATUS{, 64} ioctls riku.voipio
2016-07-19 12:54 ` riku.voipio [this message]
2016-07-19 12:54 ` [Qemu-devel] [PULL 11/16] linux-user: Handle short lengths in host_to_target_sockaddr() riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 12/16] linux-user: Add some new blk ioctls riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 13/16] TIOCGPTN and related terminal control ioctls were not converted to the guest ioctl format on x86_64 targets. Convert these ioctls to enable terminal functionality on x86_64 guests riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 14/16] linux-user: define missing sparc syscalls riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 15/16] linux-user: Fix type for SIOCATMARK ioctl riku.voipio
2016-07-19 12:54 ` [Qemu-devel] [PULL 16/16] linux-user: AArch64 has sync_file_range, not sync_file_range2 riku.voipio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=31efaef1d9b80b7803e22ef28ffc51df04db60ab.1468932683.git.riku.voipio@linaro.org \
    --to=riku.voipio@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).