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                               [EMAIL PROTECTED]
Network & Software Engineering                   http://www.netsweng.com/
1024D/37A79149:                                  0791 D3B8 9A4C 2CDC A31F
                                                 BD03 0A62 E534 37A7 9149
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 via email to