Bug in kernel/signal.c

David Wragg (dpw@doc.ic.ac.uk)
13 Jul 1998 01:09:26 +0000


Hi,

>From linux-2.1.108/kernel/signal.c, line 812:
> && (sig == SIGCONT ||
> sig == SIGCHLD ||
> sig != SIGWINCH))) {

This test above is equivalent to (sig != SIGWINCH), which must be
wrong. IMHO, it should match the test at line 281, as in the patch
below.

Here's a demonstration of the kind of problem caused. This code should
be killed when it unblocks the signal, but instead the signal gets
discarded:

#include <signal.h>
#include <stdlib.h>
#include <unistd.h>

#define SIG SIGINT

int main(void)
{
sigset_t ss;
sigemptyset(&ss);
sigaddset(&ss, SIG);
sigprocmask(SIG_BLOCK, &ss, NULL);
kill(getpid(), SIG);
signal(SIG, SIG_DFL);
sigprocmask(SIG_UNBLOCK, &ss, NULL);
return 0;
}

--
Dave Wragg.

diff -ru linux-2.1.108/kernel/signal.c linux-2.1.108.mod/kernel/signal.c --- linux-2.1.108/kernel/signal.c Fri Jun 26 23:36:03 1998 +++ linux-2.1.108.mod/kernel/signal.c Sun Jul 12 22:46:58 1998 @@ -809,9 +809,8 @@ if (k->sa.sa_handler == SIG_IGN || (k->sa.sa_handler == SIG_DFL - && (sig == SIGCONT || - sig == SIGCHLD || - sig != SIGWINCH))) { + && (sig == SIGCONT || sig == SIGCHLD + || sig == SIGWINCH || sig == SIGURG))) { /* So dequeue any that might be pending. XXX: process-wide signals? */ if (sig >= SIGRTMIN &&

- 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.altern.org/andrebalsa/doc/lkml-faq.html