ragator segfaults

Carter Bullard carter at qosient.com
Fri Feb 4 11:29:21 EST 2005


Hey Russell,
  Here is a patch that will give us some explaination for the calloc()
error.  The nflag changes are just in the cvs, not an issue.

Carter


cvs diff argus_filter.c
Index: argus_filter.c
===================================================================
RCS file: /usr/local/cvsroot/argus-clients/common/argus_filter.c,v
retrieving revision 1.11
diff -r1.11 argus_filter.c
3957c3957
<       if (nflag > 1) {
---
>       if (nflag > 2) {
4146c4146
<    if (nflag > 1)
---
>    if (nflag > 2)
5208c5208,5209
<       retn = (unsigned int *) calloc (1, bytes + 4);
---
>       if ((retn = (unsigned int *) calloc (1, bytes + 4)) == NULL)
>          ArgusLog (LOG_ERR, "ArgusCalloc(%d, %d): calloc error: %s", nitems,
size, strerror(errno));






> From: Carter Bullard <carter at qosient.com>
> Date: Fri, 04 Feb 2005 11:02:52 -0500
> To: Russell Fulton <r.fulton at auckland.ac.nz>, Argus
> <argus-info at lists.andrew.cmu.edu>
> Subject: Re: [ARGUS] ragator segfaults
> 
> Hey Russell,
>    Hmmmmmm, does this run on any other kind of machine?  If you can share
> the file, upload it to ftp://qosient.com/incoming and I'll take a look,
> and I'll add the null check to the calloc and make a strerror() printout
> so we can see whats going on.
> 
> 
> Carter
> 
> 
> 
>> From: Russell Fulton <r.fulton at auckland.ac.nz>
>> Date: Fri, 04 Feb 2005 17:15:57 +1300
>> To: <argus-info at lists.andrew.cmu.edu>
>> Subject: Re: [ARGUS] ragator segfaults
>> 
>> hmmm... .debug does not seem to work any more.  I nobbled the make files
>> in common and client to compile with symbols.
>> 
>> 
>> -bash-3.00$ gdb bin/ragator ragator.core
>> GNU gdb 6.1
>> Copyright 2004 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License, and you
>> are
>> welcome to change it and/or distribute copies of it under certain
>> conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for
>> details.
>> This GDB was configured as "i386-unknown-openbsd3.6"...
>> Core was generated by `ragator'.
>> Program terminated with signal 11, Segmentation fault.
>> Reading symbols from /usr/lib/libm.so.2.0...done.
>> Loaded symbols for /usr/lib/libm.so.2.0
>> Reading symbols from /usr/lib/libc.so.34.1...done.
>> Loaded symbols for /usr/lib/libc.so.34.1
>> Reading symbols from /usr/libexec/ld.so...done.
>> Loaded symbols for /usr/libexec/ld.so
>> #0  0x1c02c973 in ArgusCalloc (nitems=1, size=124)
>> at ./argus_filter.c:5210
>> 5210          *retn = 0x45672381;
>> (gdb) l
>> 5205
>> 5206       if (size) {
>> 5207          ArgusCallocTotal++;
>> 5208          retn = (unsigned int *) calloc (1, bytes + 4);
>> 5209
>> 5210          *retn = 0x45672381;
>> 5211          retn++;
>> 5212       }
>> 5213
>> 5214    #ifdef ARGUSDEBUG
>> (gdb) p retn
>> $1 = (unsigned int *) 0x0
>> 
>> So yes, it seems to be  running out of memory get a lousy 4 byte int!
>> and the calloc return is not checked.
>> 
>> This is weird since the box has 300MB of free memory and the file I am
>> processing is about 15 MB.
>> 
>> Is it possible that the memory is being allocated out of some limited
>> kernel pool?
>> 
>> OS is OBSD 3.6
>> 
>> One more thing, it does work with file of under 10MB.
>> 
>> Russell.
> 
> 
> 





More information about the argus mailing list