public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] emit logging when a process receives a fatal signal
@ 2006-11-18 11:46 Mikael Pettersson
  2006-11-18 13:32 ` Folkert van Heusden
  0 siblings, 1 reply; 17+ messages in thread
From: Mikael Pettersson @ 2006-11-18 11:46 UTC (permalink / raw)
  To: folkert, linux-kernel

On Sat, 18 Nov 2006 02:09:46 +0100, Folkert van Heusden wrote:
>I found that sometimes processes disappear on some heavily used system
>of mine without any logging. So I've written a patch against 2.6.18.2
>which emits logging when a process emits a fatal signal.
>
>Signed-off-by: Folkert van Heusden <folkert@vanheusden.com>
>
>--- linux-2.6.18.2/kernel/signal.c	2006-11-04 02:33:58.000000000 +0100
>+++ linux-2.6.18.2.new/kernel/signal.c	2006-11-17 15:59:13.000000000 +0100
>@@ -706,6 +706,15 @@
> 	struct sigqueue * q = NULL;
> 	int ret = 0;
> 
>+	if (sig == SIGQUIT || sig == SIGILL  || sig == SIGTRAP ||
>+	    sig == SIGABRT || sig == SIGBUS  || sig == SIGFPE  ||
>+	    sig == SIGSEGV || sig == SIGXCPU || sig == SIGXFSZ ||
>+	    sig == SIGSYS  || sig == SIGSTKFLT)
>+	{
>+		printk(KERN_WARNING "Sig %d send to %d owned by %d.%d (%s)\n",
>+			sig, t -> pid, t -> uid, t -> gid, t -> comm);
>+	}
>+
> 	/*
> 	 * fast-pathed signals for kernel-internal things like SIGSTOP
> 	 * or SIGKILL.

NAK.

1. It lets any user DOS the system.
2. Your definition of "fatal" signals is wrong. Several of these
   signals can be caught, and user-space sometimes does that for
   good reason. FPE and SEGV are definitely often caught, BUS and
   ILL may be caught, and I suspect TRAP to be common in debugging
   sessions.
3. It puts policy in the kernel. Policy decisions belong in user-space.
   In this case, the policy decision is whether this type of logging
   is desired for a given process or not.
4. If this is about detecting the loss of specific processes
   (network services say), then the problem can be solved in
   user-space by using a separate monitor process, or by
   controlling the processes via ptrace.

At a minimum, the logging needs to be conditionalised on a
per-process setting, and it should also be delayed until the
point where a signal causes a process to be killed.

/Mikael

^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH] emit logging when a process receives a fatal signal
@ 2006-11-18  1:09 Folkert van Heusden
  2006-11-18  1:26 ` Oleg Verych
  0 siblings, 1 reply; 17+ messages in thread
From: Folkert van Heusden @ 2006-11-18  1:09 UTC (permalink / raw)
  To: linux-kernel

Hi,

I found that sometimes processes disappear on some heavily used system
of mine without any logging. So I've written a patch against 2.6.18.2
which emits logging when a process emits a fatal signal.

Signed-off-by: Folkert van Heusden <folkert@vanheusden.com>

--- linux-2.6.18.2/kernel/signal.c	2006-11-04 02:33:58.000000000 +0100
+++ linux-2.6.18.2.new/kernel/signal.c	2006-11-17 15:59:13.000000000 +0100
@@ -706,6 +706,15 @@
 	struct sigqueue * q = NULL;
 	int ret = 0;
 
+	if (sig == SIGQUIT || sig == SIGILL  || sig == SIGTRAP ||
+	    sig == SIGABRT || sig == SIGBUS  || sig == SIGFPE  ||
+	    sig == SIGSEGV || sig == SIGXCPU || sig == SIGXFSZ ||
+	    sig == SIGSYS  || sig == SIGSTKFLT)
+	{
+		printk(KERN_WARNING "Sig %d send to %d owned by %d.%d (%s)\n",
+			sig, t -> pid, t -> uid, t -> gid, t -> comm);
+	}
+
 	/*
 	 * fast-pathed signals for kernel-internal things like SIGSTOP
 	 * or SIGKILL.


Folkert van Heusden

www.vanheusden.com/multitail - multitail is tail on steroids. multiple
               windows, filtering, coloring, anything you can think of
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2006-11-21  5:40 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-18 11:46 [PATCH] emit logging when a process receives a fatal signal Mikael Pettersson
2006-11-18 13:32 ` Folkert van Heusden
2006-11-18 19:31   ` Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2006-11-18  1:09 Folkert van Heusden
2006-11-18  1:26 ` Oleg Verych
2006-11-18  2:02   ` Folkert van Heusden
2006-11-18  2:04     ` Folkert van Heusden
2006-11-18  2:38       ` Oleg Verych
2006-11-18 10:39         ` Miquel van Smoorenburg
2006-11-18 14:09           ` Oleg Verych
2006-11-18 19:30         ` Jan Engelhardt
2006-11-18 21:51           ` Oleg Verych
2006-11-18 23:24             ` Jan Engelhardt
2006-11-19  7:13               ` Oleg Verych
2006-11-19 10:47                 ` Jan Engelhardt
2006-11-21  3:48     ` Marty Leisner
2006-11-21  5:47       ` Oleg Verych

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox