[Nagiosplug-devel] race condition in popen.c

Ollie Cook ollie at uk.clara.net
Thu Dec 9 05:33:03 CET 2004


Hi,

There is a race condition in popen.c which might result in a segmentation
violation under certain circumstances.

I found this while debugging check_ping. If the call to spopen is not made
within 'timeout' (default:10) seconds of the call to alarm(3) and
popen_timeout_alarm_handler has been set as the signal handler for SIGALRM,
then the childpid array will not yet have been allocated.

The potentially fatal dereference in popen_timeout_alarm_handler is:

		kill (childpid[fileno (child_process)], SIGKILL);

The safest fix for this would be for clients to initialise childpid before
calling alarm(3), although putting the onus on the client is some cause for
concern? Do others have a view on this?

Yours,

Ollie
-- 
Ollie Cook         Systems Architect, Claranet UK
ollie at uk.clara.net               +44 20 7685 8065




More information about the Devel mailing list