Skip to contentSkip to conversation

signal syscall fixes

PATCH New Stuart Anderson 1 participant 1 message Mar 30, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 signal syscall fixes

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
cpu-exec.c +5 -0
Index: qemu/cpu-exec.c
===================================================================
@@ -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,
linux-user/signal.c +1 -1
Index: qemu/linux-user/signal.c
===================================================================
@@ -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)