qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stuart Anderson <anderson@netsweng.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] signal syscall fixes
Date: Thu, 29 Mar 2007 21:53:25 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0703292146390.514@trantor.stuart.netsweng.com> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 851 bytes --]


This patch fixes a couple of problems with signals().

The first fix, in cpu-exec.c, is needed for the case where a process
does a kill(SIGSEGV) on itself (as is done in a test suite). This fix
for ARM is similar to what is done for some of the other architectures.
I'm not 100% certain this is the best fix, but it does yield the right
results when running the test suite.

The second fix is simple. sigaction() is supposed to fail if SIGKILL or
SIGSTOP is passed in. Those signals may not be blocked or ignored.


                                 Stuart

Stuart R. Anderson                               anderson@netsweng.com
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                  BD03 0A62 E534 37A7 9149

[-- Attachment #2: signal fixes --]
[-- Type: TEXT/x-diff, Size: 1301 bytes --]

Index: qemu/cpu-exec.c
===================================================================
--- qemu.orig/cpu-exec.c	2007-03-26 13:51:50.000000000 -0400
+++ qemu/cpu-exec.c	2007-03-26 13:52:21.000000000 -0400
@@ -952,10 +952,15 @@
            a virtual CPU fault */
         cpu_restore_state(tb, env, pc, puc);
     }
+    if( ret == 1 ) {
+        sigprocmask(SIG_SETMASK, old_set, NULL);
+        //raise_exception_err(env->exception_index, env->error_code);
+    } else {
     /* we restore the process signal mask as the sigreturn should
        do it (XXX: use sigsetjmp) */
     sigprocmask(SIG_SETMASK, old_set, NULL);
     cpu_loop_exit();
+    }
 }
 #elif defined(TARGET_SPARC)
 static inline int handle_cpu_signal(unsigned long pc, unsigned long address,
Index: qemu/linux-user/signal.c
===================================================================
--- qemu.orig/linux-user/signal.c	2007-03-26 13:51:50.000000000 -0400
+++ qemu/linux-user/signal.c	2007-03-26 13:52:21.000000000 -0400
@@ -422,7 +422,7 @@
     struct sigaction act1;
     int host_sig;
 
-    if (sig < 1 || sig > TARGET_NSIG)
+    if (sig < 1 || sig > TARGET_NSIG || sig == SIGKILL || sig == SIGSTOP)
         return -EINVAL;
     k = &sigact_table[sig - 1];
 #if defined(DEBUG_SIGNAL)

                 reply	other threads:[~2007-03-30  1:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.64.0703292146390.514@trantor.stuart.netsweng.com \
    --to=anderson@netsweng.com \
    --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).