[PATCH] Unkillable process

From: Christophe Blaess (ccb@club-internet.fr)
Date: Mon Jan 10 2000 - 15:14:48 EST


Hello,

I think there's a problem with the Posix.1b sigtimedwait() system call,
because a process is allowed to wait for SIGKILL or SIGSTOP, and theses
signals give their numbers to the calling process, forgetting their normal
behaviour.

So the following program is unkillable :

        #include <stdio.h>
        #include <signal.h>

        int
main (void)
{
        sigset_t set;
        struct timespec timespec = {0, 0};
        sigfillset (& set);
        while (1)
                sigtimedwait (& set, NULL, & timespec);
        return (0);
}

Unkillable process means unable to umount the / partition during
shutdown, check forced at next reboot... :-(

So, here's a little patch against 2.2.14 to fix the problem.

diff -urN linux-2.2.14/kernel/signal.c linux/kernel/signal.c
--- linux-2.2.14/kernel/signal.c Mon Jan 10 20:25:40 2000
+++ linux/kernel/signal.c Mon Jan 10 20:29:17 2000
@@ -740,11 +740,11 @@
 
        if (copy_from_user(&these, uthese, sizeof(these)))
                return -EFAULT;
- else {
- /* Invert the set of allowed signals to get those we
- want to block. */
- signotset(&these);
- }
+
+ sigdelsetmask (&these, sigmask(SIGKILL)|sigmask(SIGSTOP));
+ /* Invert the set of allowed signals to get those we
+ want to block. */
+ signotset(&these);
 
        if (uts) {
                if (copy_from_user(&ts, uts, sizeof(ts)))

-- 
Christophe Blaess

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jan 15 2000 - 21:00:16 EST