linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Folkert van Heusden <folkert@vanheusden.com>
To: Andrea Righi <righiandr@users.sourceforge.net>
Cc: Andi Kleen <ak@suse.de>, Jan Engelhardt <jengelh@linux01.gwdg.de>,
	Stephen Hemminger <shemminger@linux-foundation.org>,
	Eric Dumazet <dada1@cosmosbay.com>,
	Rik van Riel <riel@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: Re: signals logged / [RFC] log out-of-virtual-memory events
Date: Mon, 21 May 2007 13:04:06 +0200	[thread overview]
Message-ID: <20070521110406.GA14802@vanheusden.com> (raw)
In-Reply-To: <46517817.1080208@users.sourceforge.net>

> >> +	switch(sig) {
> >> +	case SIGQUIT: 
...
> >> +	case SIGSTKFLT:
> > 
> > Unconditional? That's definitely a very bad idea. If anything only unhandled
> > signals should be printed this way because some programs use them internally. 
> > But I think your list is far too long anyways.
> 
> Maybe you could use somthing similar to unhandled_signal() in
> arch/x86_64/mm/fault.c, but I agree that the list seems a bit too long...

What about the following enhancement: I check with sig_fatal if it would
kill the process and only then emit a message. So when an application
takes care itself of handling it nothing is printed.

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

--- kernel/signal.c.org	2007-05-20 22:47:13.000000000 +0200
+++ kernel/signal.c	2007-05-21 12:59:52.000000000 +0200
@@ -739,6 +739,8 @@
 	struct sigqueue * q = NULL;
 	int ret = 0;
 
+	/* emit some logging for unhandled signals
+	 */
+	if (sig_fatal(t, sig))
+	{
+		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.

of course, this can also be limited to only the interesting signals:

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

--- kernel/signal.c.org	2007-05-20 22:47:13.000000000 +0200
+++ kernel/signal.c	2007-05-21 12:59:52.000000000 +0200
@@ -739,6 +739,28 @@
 	struct sigqueue * q = NULL;
 	int ret = 0;
 
+	/* emit some logging for nasty signals
+	 * especially SIGSEGV and friends aught to be looked at when happening
+	 */
+	switch(sig) {
+	case SIGQUIT: 
+	case SIGILL: 
+	case SIGTRAP:
+	case SIGABRT: 
+	case SIGBUS: 
+	case SIGFPE:
+	case SIGSEGV: 
+	case SIGXCPU: 
+	case SIGXFSZ:
+	case SIGSYS: 
+	case SIGSTKFLT:
+		if (sig_fatal(t, sig))
+		{
+			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

-- 

Multitail - gibkaja utilita po sledovaniju log-fajlov i vyvoda
kommand. Fil'trovanie, raskra?ivanie, slijanie, vizual'noe sravnenie,
i t.d.  http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2007-05-21 11:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-17 16:24 Andrea Righi
2007-05-17 18:22 ` Rik van Riel
2007-05-18  6:28   ` signals logged / " Jan Engelhardt
2007-05-18 11:47     ` Andi Kleen
2007-05-19  7:46       ` Jan Engelhardt
2007-05-19  9:35         ` Andrea Righi
2007-05-19 10:06           ` Jan Engelhardt
2007-05-19 10:16             ` Andrea Righi
2007-05-20  0:14         ` Folkert van Heusden
2007-05-20  3:55           ` Eric Dumazet
2007-05-20 11:21             ` Folkert van Heusden
2007-05-20 16:08               ` Stephen Hemminger
2007-05-20 16:12                 ` Folkert van Heusden
2007-05-20 20:38                   ` Jan Engelhardt
2007-05-20 20:55                     ` Folkert van Heusden
2007-05-20 21:14                       ` Andi Kleen
2007-05-20 21:20                         ` Folkert van Heusden
2007-05-20 21:23                           ` Folkert van Heusden
2007-05-20 22:24                           ` Andi Kleen
2007-05-20 22:22                             ` Jeff Dike
2007-05-21 10:45                         ` Andrea Righi
2007-05-21 11:04                           ` Folkert van Heusden [this message]
2007-05-21 12:30                             ` Jan Engelhardt
2007-05-21 12:47                               ` Folkert van Heusden
2007-05-21 13:58                                 ` Andrea Righi
2007-05-21 18:59                                   ` Folkert van Heusden
2007-05-21 22:15                                     ` Andrea Righi
2007-05-23 18:00                                 ` Satyam Sharma
2007-05-23 18:45                                   ` Folkert van Heusden
2007-06-10 19:53                                     ` Folkert van Heusden
2007-06-10 20:06                                       ` Jiri Kosina
2007-06-10 20:37                                         ` Jan Engelhardt
2007-05-18  7:50   ` Andrea Righi
2007-05-18  9:16     ` Robin Holt
2007-05-18 15:55       ` Andrea Righi
2007-05-18 16:05         ` Andrea Righi
2007-05-20  0:15     ` Folkert van Heusden
2007-05-20 22:21 signals logged / " Mikael Pettersson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070521110406.GA14802@vanheusden.com \
    --to=folkert@vanheusden.com \
    --cc=ak@suse.de \
    --cc=dada1@cosmosbay.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=riel@redhat.com \
    --cc=righiandr@users.sourceforge.net \
    --cc=shemminger@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox