From: Ben Gras Date: Fri, 18 Feb 2011 15:44:54 +0000 (+0000) Subject: pm - sys_sigsend can fail legitimately X-Git-Tag: v3.2.0~662 X-Git-Url: http://zhaoyanbai.com/repos/%22../static/icons/man.7.txt?a=commitdiff_plain;h=32f3d9842d60daf53d05e8da608f8478a874fb3f;p=minix.git pm - sys_sigsend can fail legitimately . specifically, if a signal handler can't be invoked due to process memory, EFAULT is returned from the kernel. don't panic() then. --- diff --git a/servers/pm/signal.c b/servers/pm/signal.c index fce84ca9c..263d49fad 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -449,6 +449,8 @@ int ksig; /* non-zero means signal comes from kernel */ return; /* We were unable to spawn a signal handler. Kill the process. */ + printf("PM: %d can't catch signal %d - killing\n", + rmp->mp_pid, signo); } else if (!badignore && sigismember(&ign_sset, signo)) { /* Signal defaults to being ignored. */ @@ -732,8 +734,16 @@ int signo; /* signal to send to process (1 to _NSIG-1) */ /* Ask the kernel to deliver the signal */ r = sys_sigsend(rmp->mp_endpoint, &sigmsg); - if (r != OK) + /* sys_sigsend can fail legitimately with EFAULT if + * the process memory can't accomodate the signal handler. + */ + if(r == EFAULT) { + return(FALSE); + } + /* Other errors are unexpected pm/kernel discrepancies. */ + if (r != OK) { panic("sys_sigsend failed: %d", r); + } /* Was the process suspended in PM? Then interrupt the blocking call. */ if (rmp->mp_flags & (PAUSED | WAITING | SIGSUSPENDED)) {