external commands and segfault -- again

Helmut W. Januschka h.januschka at krone.at
Fri Jan 5 16:08:21 CET 2007


You may move the strlen() to a sperate variable
And after that reproduce the gbd session and use "info locales" to see 
What are the actual values of the variables and maybe just the strlen fails


Also try "print name1" and "print name1[i]" and look if there are some unterminated strings 

And backtrace to  where the call to the hashfunc2 occurs and have a look at the value wich originally gots sended in

Maybe its just a old version or a bad implemantion of the tool submitting the external command (sure nagios should do a segfault at all ;)) 


Regards
helmut

-----Ursprüngliche Nachricht-----
Von: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-bounces at lists.sourceforge.net] Im Auftrag von David G Schlecht
Gesendet: Donnerstag, 04. Jänner 2007 21:42
An: nagios-users at lists.sourceforge.net
Betreff: [Nagios-users] external commands and segfault -- again

Hi All,

I'm still getting segfaults when running external commands. I don't understand
why I can't get any information on this. As some have suggested, I added a cron
job to restart Nagios when it's been down. This is a nice touch but totally
useless as Nagios crashes when someone is sending commands and it makes no sense
for them to have to wait 10-15-60 minutes for the system to restart.

This has happened since v1.2. I'm currently using v2.5 and here is a core dump
following a Schedule Downtime call:
===========
Detaching after fork from child process 19947.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208391264 (LWP 5431)]
0x0806c951 in hashfunc2 (name1=0x2 <Address 0x2 out of bounds>,
    name2=0x80f <Address 0x80f out of bounds>, hashslots=1024) at utils.c:4285
4285                    for(i=0;i<strlen(name1);i++)
(gdb)
(gdb) bt
#0  0x0806c951 in hashfunc2 (name1=0x2 <Address 0x2 out of bounds>,
    name2=0x80f <Address 0x80f out of bounds>, hashslots=1024) at utils.c:4285
#1  0x080768a1 in find_service (host_name=0x2 <Address 0x2 out of bounds>,
    svc_desc=dwarf2_read_address: Corrupted DWARF expression.
) at ../common/objects.c:5016
#2  0x0808ef4b in handle_scheduled_downtime (temp_downtime=0x9f21c00)
    at ../common/downtime.c:311
#3  0x08063454 in handle_timed_event (event=0x9fa2728) at events.c:1289
#4  0x08063a9d in event_execution_loop () at events.c:964
#5  0x0805394d in main (argc=3, argv=0xbff3f274) at nagios.c:710
(gdb)
=======

Looking at the code in utils.c, I see:
[4280]int hashfunc2(const char *name1,const char *name2,int hashslots){
[4281]        unsigned int i,result;
[4282]
[4283]        result=0;
[4284]        if(name1)
[4285]                for(i=0;i<strlen(name1);i++)
[4286]                        result+=name1[i];

Hence, the args name1 and name2 must be corrupt before the call to hashfunc2.

Where can I go from here? Any suggestions?

-Dave





-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list