Re: clamd memory corruption (may be jemalloc related)

From: Peter Jeremy <peterjeremy_at_optushome.com.au>
Date: Fri, 20 Apr 2007 19:50:01 +1000
On 2007-Apr-20 03:22:26 +0400, Anton Yuzhaninov <citrin_at_citrin.ru> wrote:
>Clamav code quality is low, and probably it has bugs :(
>But not obvious how to find this bugs.

This smells like memory is being allocated in one thread and then
being referenced in another thread before it is initialised.

My initial suggestion is to put wrappers around malloc(3) family calls
(or the program's own internal wrapper functions) that dump __FILE__,
__LINE__ and pthread_self(), together with size and address
information.  The core dump will let you identify the thread that has
detected the problem as well as the offending block of memory.  The
malloc debug output will let you detect where that block of memory is
being allocated.  It's then just a simple matter of working out the
path from the latter to the former :-).

Of course, since this appears to be a race condition between threads,
it's quite likely it will be a heisenbug.

-- 
Peter Jeremy

Received on Fri Apr 20 2007 - 07:50:21 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:09 UTC