[Nagiosplug-devel] [ nagiosplug-Bugs-951277 ] netutils.c segfault dumps core on solaris 8

SourceForge.net noreply at sourceforge.net
Thu Nov 18 15:32:04 CET 2004


Bugs item #951277, was opened at 2004-05-10 15:31
Message generated for change (Comment added) made by tonvoon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=951277&group_id=29880

Category: None
Group: Release (specify)
>Status: Pending
Resolution: None
Priority: 5
Submitted By: Mike Hulsman (mhulsman)
>Assigned to: Ton Voon (tonvoon)
Summary: netutils.c segfault dumps core on solaris 8 

Initial Comment:
I use 1.4.0alpha1 and HEAD-200405030514.
On both versions when I do a check_tcp or check_ssh 
and the port is not availabel I get a Segmentation Fault 
(core dumped).
When I put debug info in netutils.c I got yhe following 
output:
bash-2.03# ./check_tcp -H 127.0.0.1  -p 21
DBG MJH BEFORE
DBG MJH AFTER
DBG MJH 1
DBG MJH 2
DBG MJH Result: -1
DBG MJH 3
Segmentation Fault (core dumped)
I modified the netutils.c as the following:
                        *sd = socket (res->ai_family, (proto 
== IPPROTO_UDP) ?
                                      SOCK_DGRAM : 
SOCK_STREAM, res->ai_protocol);
        printf ("DBG MJH 2\n");

                        if (*sd < 0) {
                                printf ("Socket creation 
failed\n");
                                freeaddrinfo (res);
                                return STATE_UNKNOWN;
                        }

                        /* attempt to open a connection */
                        result = connect (*sd, res->ai_addr, 
res->ai_addrlen);

                        if (result == 0) {
                                was_refused = FALSE;
                                break;
                        }

                        if (result < 0) {
                        printf ("DBG MJH Result: %d\n", result);
                                switch (errno) {
                                case ECONNREFUSED:
        printf ("DBG MJH 3\n");
                                        switch 
(econn_refuse_state) {
        printf ("DBG MJH 4\n");
                                        case STATE_OK:
                                        case STATE_WARNING:
                                                was_refused = TRUE;
                                        }
                                        break;
Here is some truss info:
open("/dev/udp", O_RDONLY)                      = 3
ioctl(3, 0xC00C6982, 0xFFBEF724)                = 0
close(3)                                        = 0
brk(0x0002FF88)                                 = 0
brk(0x00031F88)                                 = 0
sigaction(SIGALRM, 0xFFBEFBA0, 0xFFBEFC20)      = 0
alarm(10)                                       = 0
ioctl(1, TCGETA, 0xFFBEF9F4)                    = 0
DBG MJH BEFORE
write(1, " D B G   M J H   B E F O".., 15)      = 15
DBG MJH AFTER
write(1, " D B G   M J H   A F T E".., 14)      = 14
DBG MJH 1
write(1, " D B G   M J H   1\n", 10)            = 10
so_socket(2, 2, 0, "", 1)                       = 3
DBG MJH 2
write(1, " D B G   M J H   2\n", 10)            = 10
connect(3, 0x0002EE68, 16, 1)                   Err#146 
ECONNREFUSED
DBG MJH Result: -1
write(1, " D B G   M J H   R e s u".., 19)      = 19
DBG MJH 3
write(1, " D B G   M J H   3\n", 10)            = 10
close(3)                                        = 0
    Incurred fault #6, FLTBOUNDS  %pc = 0xFF364B44
      siginfo: SIGSEGV SEGV_MAPERR addr=0x0000001C
    Received signal #11, SIGSEGV [default]
      siginfo: SIGSEGV SEGV_MAPERR addr=0x0000001C
        *** process killed ***

The following is when a session is OK:
bash-2.03# ./check_tcp -H 127.0.0.1  -p 22
DBG MJH BEFORE
DBG MJH AFTER
DBG MJH 1
DBG MJH 2
TCP OK - 0.002 second response time on port 22 
|time=2315us;0;0;0;10000



----------------------------------------------------------------------

>Comment By: Ton Voon (tonvoon)
Date: 2004-11-18 23:31

Message:
Logged In: YES 
user_id=664364

Mike,

Thanks for the detailed bug report. There looks like there have been lots 
of fixes to netutils.c since your report. Can you please try a more recent 
version? I've tried on Sol9 and this does not core dump.

I have marked this call into pending as we try and reduce the number of 
calls in the run-up to the new release.

Ton

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=951277&group_id=29880




More information about the Devel mailing list