qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] signal syscall fixes
@ 2007-03-30  1:53 Stuart Anderson
  0 siblings, 0 replies; only message in thread
From: Stuart Anderson @ 2007-03-30  1:53 UTC (permalink / raw)
  To: qemu-devel

[-- 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-30  1:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-30  1:53 [Qemu-devel] [PATCH] signal syscall fixes Stuart Anderson

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).