Clamav-90_2 Lockup with freebsd 6.2
Martin Blapp
mb at imp.ch
Sat Mar 10 11:17:46 UTC 2007
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);
More information about the freebsd-stable
mailing list