Date: Sat, 10 Mar 2007 12:17:42 +0100 (CET) From: Martin Blapp <mb@imp.ch> To: ClamAV Development <clamav-devel@lists.clamav.net> Cc: Daniel Eischen <deischen@freebsd.org>, freebsd-stable@freebsd.org Subject: Re: Clamav-90_2 Lockup with freebsd 6.2 Message-ID: <20070310121342.I6787@godot.imp.ch> In-Reply-To: <1173106098.8193.6.camel@syntax.dstl.gov.uk> References: <20070305152453.H18301@godot.imp.ch> <1173106098.8193.6.camel@syntax.dstl.gov.uk>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi, > Don't use it, it's broken. > > -trog Nope, it looks like a race in cli_scanmail() which deadlocks somewhere with libpthread.so. This workaround fixes the problem for me. I'm still investigating where the real cause for this problem is. --- libclamav/scanners.c Tue Feb 13 02:06:28 2007 +++ libclamav/scanners.c Sat Mar 10 12:00:16 2007 @@ -38,6 +38,9 @@ #include <netinet/in.h> #endif +# include <pthread.h> +static pthread_mutex_t extractmail_mutex = PTHREAD_MUTEX_INITIALIZER; + #if HAVE_MMAP #if HAVE_SYS_MMAN_H #include <sys/mman.h> @@ -1652,12 +1655,16 @@ /* * Extract the attachments into the temporary directory */ + pthread_mutex_lock(&extractmail_mutex); if((ret = cli_mbox(dir, desc, ctx))) { - if(!cli_leavetemps_flag) + if(!cli_leavetemps_flag) { + pthread_mutex_unlock(&extractmail_mutex); cli_rmdirs(dir); + } free(dir); return ret; } + pthread_mutex_unlock(&extractmail_mutex); ret = cli_scandir(dir, ctx);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070310121342.I6787>