[Nagiosplug-devel] [ nagiosplug-Bugs-1573638 ] check_swap SEGV's on Solaris

SourceForge.net noreply at sourceforge.net
Thu Dec 7 17:11:44 CET 2006


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

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Duncan Ferguson (duncan_ferguson)
>Assigned to: Ton Voon (tonvoon)
Summary: check_swap SEGV's on Solaris

Initial Comment:
$ ./check_swap -w 20% -c 10%
swapctl failed: : Bad address
Segmentation Fault(coredump)
$ uname -a
SunOS xxxx 5.10 Generic_118833-18 sun4u sparc
SUNW,Sun-Fire-V440

This is from "nagios-plugins-HEAD-200610082352.tar.gz"

It seems to compile ok:
===
if gcc
-DLOCALEDIR=\"/home/loki/fergusod/cvsroot/nagios2/shared/egg-nagios2cl/package/usr/local/nagios2cl/share/locale\"
-DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../intl  
-I/usr/sfw//include   -I/usr/sfw//include  -g -O2 -MT
check_swap.o -MD -MP -MF ".deps/check_swap.Tpo" -c -o
check_swap.o check_swap.c; \
then mv -f ".deps/check_swap.Tpo"
".deps/check_swap.Po"; else rm -f
".deps/check_swap.Tpo"; exit 1; fi
In file included from check_swap.c:33:
common.h:216: warning: static declaration of 'floorf'
follows non-static declaration
/bin/bash ../libtool --tag=CC --mode=link gcc  -g -O2 
 -L/usr/sfw/lib -L. -L/usr/sfw//lib -o check_swap 
check_swap.o -lm utils.o ../lib/libnagiosplug.a
../lib/libcoreutils.a popen.o -lsocket  -lssl -lcrypto
gcc -g -O2 -o check_swap check_swap.o utils.o popen.o 
-L/usr/sfw/lib
-L/tmp/nagios-plugins-HEAD-200610082352/plugins
-L/usr/sfw//lib -lm ../lib/libnagiosplug.a
../lib/libcoreutils.a -lsocket -lssl -lcrypto

===
This appears to be the code at issue ( the SVR4 flag is
in effect rather than the BSD one)

#  ifdef CHECK_SWAP_SWAPCTL_SVR4

  /* get the number of active swap devices */
  nswaps=swapctl(SC_GETNSWP, NULL);

  /* initialize swap table + entries */
 
tbl=(swaptbl_t*)malloc(sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
  memset(tbl, 0,
sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
  tbl->swt_n=nswaps;
  for(i=0;i<nswaps;i++){
    ent=&tbl->swt_ent[i];
    ent->ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN);
  }

  /* and now, tally 'em up */
  swapctl_res=swapctl(SC_LIST, tbl);
  if(swapctl_res < 0){
    perror(_("swapctl failed: "));
    result = STATE_WARNING;
  }


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

>Comment By: Ton Voon (tonvoon)
Date: 2006-12-07 16:11

Message:
Logged In: YES 
user_id=664364
Originator: NO

Duncan,

Closing this call as this is fixed via patch 1588031.

Ton

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

Comment By: Duncan Ferguson (duncan_ferguson)
Date: 2006-10-31 17:05

Message:
Logged In: YES 
user_id=865292

I have submitted a patch in the tracker for check_swap to
fix the coredump on all solaris versions (and other SVR4
hosts) and tidy up the error output a little.  However, it
still does not work correctly as I keep getting the error
"swapctl failed: Bad address".

As far as I can tell (with a lot of hacking of the code by
commenting out everything possible) if compiled directly
using gcc it works, but when using "make" it doesnt, as
though something included via common.h, popen.h or utils.h
is causing an issue but i have so far been unable to trace
the cause.  I have also compared the code to an example at
http://www.idiom.com/~gford/admin/howto/perf.html#swapctl
but there are no disernable differences, leading me to think
the issue is outside of this source file.

I'll keep hacking incase by luck i find the issue.

  Duncs

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

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




More information about the Devel mailing list