2003-09-14 01:28:58

by folkert

[permalink] [raw]
Subject: logging when SIGSEGV is processed?

Hi,

I found this patch for kernel 2.2 which logs a message when some process
receives SIGSEGV. Imho something very usefull: I could create some script
which sends an e-mail if some critical (apache, mysql, etc.) process
segfaults. I was wondering: has anyone ported this patch to 2.4 or 2.6?


Folkert van Heusden

+--------------------------------------------------------------------------+
| UNIX sysop? Then give MultiTail ( http://www.vanheusden.com/multitail/ ) |
| a try, it brings monitoring logfiles (and such) to a different level! |
+---------------------------------------------------= http://www.vanheusden.com =-+


2003-09-14 02:18:32

by Joshua Kwan

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

On Sun, Sep 14, 2003 at 03:28:54AM +0200, Folkert van Heusden wrote:
> I found this patch for kernel 2.2 which logs a message when some process
> receives SIGSEGV. Imho something very usefull: I could create some script
> which sends an e-mail if some critical (apache, mysql, etc.) process
> segfaults. I was wondering: has anyone ported this patch to 2.4 or 2.6?

What patch?

--
Joshua Kwan


Attachments:
(No filename) (399.00 B)
(No filename) (827.00 B)
Download all attachments

2003-09-14 07:23:37

by folkert

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

On Sunday 14 September 2003 04:18, Joshua Kwan wrote:
> On Sun, Sep 14, 2003 at 03:28:54AM +0200, Folkert van Heusden wrote:
> > I found this patch for kernel 2.2 which logs a message when some process
> > receives SIGSEGV. Imho something very usefull: I could create some script
> > which sends an e-mail if some critical (apache, mysql, etc.) process
> > segfaults. I was wondering: has anyone ported this patch to 2.4 or 2.6?
>
> What patch?

http://www.kyuzz.org/antirez/sigsegv/


Folkert van Heusden

+--------------------------------------------------------------------------+
| UNIX sysop? Then give MultiTail ( http://www.vanheusden.com/multitail/ ) |
| a try, it brings monitoring logfiles (and such) to a different level! |
+---------------------------------------------------= http://www.vanheusden.com =-+

2003-09-14 11:14:18

by Mo McKinlay

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

> I found this patch for kernel 2.2 which logs a message when some process
> receives SIGSEGV.

Why not just do it in userspace? A program which does nothing more than
spawn a child and wait for it to terminate, performing some action based on
the kind and status of exit, should be fairly trivial?

Admittedly, it might need some shoehorning into some existing setups (i.e.,
where the daemon you wish to watch isn't started directly, but by something
else), but it wouldn't be too tricky, I'd've thought.

[See wait(2), specifically the bits about how to interpret `status']

Mo.

2003-09-14 17:17:43

by bert hubert

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

On Sun, Sep 14, 2003 at 12:14:08PM +0100, Mo McKinlay wrote:

> Admittedly, it might need some shoehorning into some existing setups (i.e.,
> where the daemon you wish to watch isn't started directly, but by something
> else), but it wouldn't be too tricky, I'd've thought.

init receives that stuff if a process has no other parent, I think, so that
might be a great place.

--
http://www.PowerDNS.com Open source, database driven DNS Software
http://lartc.org Linux Advanced Routing & Traffic Control HOWTO

2003-09-15 07:10:09

by Alex Riesen

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

bert hubert, Sun, Sep 14, 2003 19:17:41 +0200:
> On Sun, Sep 14, 2003 at 12:14:08PM +0100, Mo McKinlay wrote:
>
> > Admittedly, it might need some shoehorning into some existing setups (i.e.,
> > where the daemon you wish to watch isn't started directly, but by something
> > else), but it wouldn't be too tricky, I'd've thought.
>
> init receives that stuff if a process has no other parent, I think, so that
> might be a great place.
>

will not work if the signal received by the child of a daemon, which does
nothing about its status.

Probably ptrace the daemon (following all its children) would server better.
The feature (logging the coredumps) is definitely no needed for
everything, just some suspectables.

2003-09-15 07:49:02

by Alan

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

On Llu, 2003-09-15 at 08:09, Alex Riesen wrote:
> Probably ptrace the daemon (following all its children) would server better.
> The feature (logging the coredumps) is definitely no needed for
> everything, just some suspectables.

accton() will turn on logging and that gives you log records of process
termination including if it segfaulted.

2003-09-15 16:05:55

by folkert

[permalink] [raw]
Subject: Re: logging when SIGSEGV is processed?

> On Llu, 2003-09-15 at 08:09, Alex Riesen wrote:
> > Probably ptrace the daemon (following all its children) would server
> > better. The feature (logging the coredumps) is definitely no needed for
> > everything, just some suspectables.
> accton() will turn on logging and that gives you log records of process
> termination including if it segfaulted.

Sound's good. You probably mean acct()? There's one little problem with that
one:
NOTES
No accounting is produced for programs running when a
crash occurs. In particular, nonterminating processes are
never accounted for.


Folkert van Heusden

+--------------------------------------------------------------------------+
| UNIX sysop? Then give MultiTail ( http://www.vanheusden.com/multitail/ ) |
| a try, it brings monitoring logfiles (and such) to a different level! |
+---------------------------------------------------= http://www.vanheusden.com =-+