Re: [patch] log fatal signals like SIGSEGV

From: Mikael Pettersson
Date: Sun Sep 21 2008 - 15:06:19 EST


Thomas Jarosch writes:
> Hello together,
>
> here's the reworked version of the signal logging patch.
> Many thanks to Marcin Slusarz for reviewing it.
>
> The idea is to briefly log "fatal" signals by default, the output
> should be close to zero during normal system operation.
> Faulty hardware gets detected much quicker
> if you see crashing apps in the logs.
>
> The patch applies to 2.6.26 and git HEAD.
> scripts/checkpatch.pl is happy, too.
>
> I'm off for a vacation, so expect a delay of some days
> if there should be additional questions or comments.
>
> Hope the new feature is as useful to others as it has been to me.
>
> Enjoy,
> Thomas
>
> ------------------------------------------------------
> From: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
>
> Log signals like SIGSEGV, SIGILL, SIGBUS or SIGFPE to aid tracing
> of obscure problems. Also logs the sender of the signal.

I believe the approach taken in this patch is broken:

1. The signal logging decision is taken before signal delivery,
which causes *handled* signals in the above list to be logged.
So your printk_ratelimit() can be swamped by handled signals
causing it to not log unhandled fatal signals.

Applications that handle SEGV/BUS/ILL/FPE aren't that uncommon.

2. Fatal signals are only interesting if they are self-generated.
Signals sent from other processes or threads are uninteresting,
if the purpose is to detect program errors or faulty hardware.

3. Similar functionality already exists in the kernel, except
it correctly runs much later in the signal delivery path.
Grep for print_fatal_signals and show_unhandled_signals.

There's also some trace hooks in the signal delivery path
that look like they could log actual fatal signals.

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