[Pkg-nagios-devel] Bug#743493: send_nsca signal handling is undefined behaviour, causes SEGVs

Matthew Vernon mcv21 at cam.ac.uk
Thu Apr 3 11:58:05 UTC 2014


Package: nsca
Version: 2.9.1-2
Severity: important
Tags: upstream, patch
Control: found -1 2.7.2

Hi,

I tripped over this bug because send_nsca was SEGVing on a machine
where another high-priority process was chewing up nearly all the
CPU. Our cron scripts just complained about SEGV, but running it on
the console resulted in:

Error: Timeout after 10 seconds
Segmentation fault

On investigation, this is because send_nsca's alarm_handler function
(installed as the handler for SIGALRM) does all sorts of things that
are undefined in a signal handler, such as printf, memset, free.

I attach a simple patch that replaces the buggy signal handler with
one that emits an error message and then exits. I'm not convinced that
there's enough merit in the memory-"cleaning" that do_exit does to do
the harder work of trying to sort that out.

Regards,

Matthew

-- System Information:
Debian Release: 7.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages nsca depends on:
ii  confget                1.03-1
ii  debconf [debconf-2.0]  1.5.49
ii  libc6                  2.13-38+deb7u1
ii  libmcrypt4             2.5.8-3.1
ii  nsca-client            2.9.1-2

nsca recommends no packages.

Versions of packages nsca suggests:
pn  nagios-plugins-basic | nagios-plugins  <none>
pn  nagios3                                <none>

-- debconf information excluded
-------------- next part --------------
A non-text attachment was scrubbed...
Name: send_nsca.diff
Type: text/x-diff
Size: 520 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-nagios-devel/attachments/20140403/9220368d/attachment.diff>


More information about the Pkg-nagios-devel mailing list