Hi All,

The 'clamd' daemon (version 0.60 stable) throws a segfault when reloading the virus signatures database on OpenBSD (at least on versions 2.7 and 3.1.) This is very easy to reproduce - start clamd, touch viruses.db2 and wait.

A backtrace shows that the segfault occurs in memset() which is part of the calloc() call made from the cli_calloc function within libclamav (calloc on OpenBSD is implemented as a malloc followed by a memset if the malloc succeeded.)

The other interesting thing is that it always occurs when attempting to load a particular signature (Worm.Sircam.C.) If this signature is removed it will typically fail on the one directly after it, although not always.

I originally thought that it may have been running into a stack/data limit, however the clamd process is only 12MB in size (soft limit for memory is 64MB on this machine.) Given that nothing is using the daemon (ie. no connections are made) I doubt that it is a race condition, although I don't know the code well enough to make this call. I'm guessing that the pointer or memory is getting trampled half way through the malloc/memset...

Additionally, if I send a SIGTERM to clamd it starts using 30-90% of the CPU and doesn't exit. Not sure if this is related to the above mentioned issue or something completely seperate - will dig into this soon...

Any pointers/suggestions on where to start looking?

Thanks,

Joel

PS. Backtrace below, coredump available upon request...

Program received signal SIGSEGV, Segmentation fault.
0x400b5e68 in memset ()
(gdb) bt


#0 0x400b5e68 in memset ()
#1 0x648e6663 in ?? ()
#2 0x40023889 in cli_calloc (nmemb=1, size=24) at others.c:182
#3 0x40023cfd in cli_parse_add (root=0x18000,
virname=0xb1cefc "Worm.Sircam.C (Clam)",
hexstr=0xb1cf11 "8c0d56e81063c5bdc039c49f91cdd10b390fc8cc89b58278b3b1d00cd456633719bfd66a43f0a128448d0fc64ec686c9546847eb5a9594323276c63e985b9ca032723272a4a8940248c925cf905090c66b86c9a326663920a6a919146188e367a2716190"..., sigid=0,
parts=0, partno=0) at readdb.c:45
#4 0x4002424d in cl_loaddb (filename=0x11a140 "/tmp/clamav/db/viruses.db",
root=0xdfbfda68, virnum=0xb3cfa8) at readdb.c:145
#5 0x40024508 in cl_loaddbdir (dirname=0xe0b0 "/tmp/clamav/db",
root=0xdfbfda68, virnum=0xb3cfa8) at readdb.c:193
#6 0x468b in threadwatcher (arg=0xdfbfda50) at server.c:322
#7 0x40042518 in _thread_start ()


----------------------------------------------------------------------------
             => Joel Sing | [EMAIL PROTECTED] | 0419 577 603 <=
----------------------------------------------------------------------------

 "I'm not worried about Artificial Intelligence, when they invent
  Artificial Stupidiy, then I'll be scared. I'm sorry Dave, I don't feel
  like doing that." ~Unknown



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Clamav-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-devel

Reply via email to