John Ogness | 9 Sep 2009 00:37

[PATCH] Clamuko: DazukoFS support + fix reload race

This is a patch against ClamAV 0.95.2 that introduces DazukoFS support
for Clamuko. If /dev/dazukofs.ctrl is not found, it falls back to the
original Clamuko (Dazuko) code.

The following config options do not have any meaning with DazukoFS:
   ClamukoScanOnOpen, ClamukoScanOnClose, ClamukoScanOnExec,
   ClamukoIncludePath, ClamukoExcludePath
If using DazukoFS with these options specified, a warning is logged.

A new config option ClamukoScannerCount is also introduced (only for
use with DazukoFS). It specifies how many scanner threads should be
started for Clamuko. It defaults to 3.

Note that no virus handling is supported with DazukoFS. File access
can only be blocked. This is something that may be added later.

This patch also fixes a race condition in clamd/server-th.c where
Clamuko could scan files while the db was reloaded. This caused the
the scanner thread to sit in cl_scandesc() with 100% CPU forever.
Now a reload of Clamuko will be done cleanly.

This patch has been tested on Linux/ppc 2.6.30.5 together with
DazukoFS 3.1.0-rc2.

Signed-off-by: John Ogness <dazukocode <at> ogness.net>
---
 clamd/Makefile.am  |    4 
 clamd/Makefile.in  |   14 ++-
 clamd/clamuko.c    |   14 ++-
 clamd/clamukofs.c  |  246 +++++++++++++++++++++++++++++++++++++++++++++++++++++
(Continue reading)

Tomasz Kojm | 9 Sep 2009 23:25
Favicon

Re: [PATCH] Clamuko: DazukoFS support + fix reload race

On Wed Sep 09 2009 00:37:14 GMT+0200 (CEST)
John Ogness <dazukocode <at> ogness.net> wrote:
> This is a patch against ClamAV 0.95.2 that introduces DazukoFS support
> for Clamuko. If /dev/dazukofs.ctrl is not found, it falls back to the
> original Clamuko (Dazuko) code.
> 
> The following config options do not have any meaning with DazukoFS:
>    ClamukoScanOnOpen, ClamukoScanOnClose, ClamukoScanOnExec,
>    ClamukoIncludePath, ClamukoExcludePath
> If using DazukoFS with these options specified, a warning is logged.
> 
> A new config option ClamukoScannerCount is also introduced (only for
> use with DazukoFS). It specifies how many scanner threads should be
> started for Clamuko. It defaults to 3.
> 
> Note that no virus handling is supported with DazukoFS. File access
> can only be blocked. This is something that may be added later.
> 
> This patch also fixes a race condition in clamd/server-th.c where
> Clamuko could scan files while the db was reloaded. This caused the
> the scanner thread to sit in cl_scandesc() with 100% CPU forever.
> Now a reload of Clamuko will be done cleanly.
> 
> This patch has been tested on Linux/ppc 2.6.30.5 together with
> DazukoFS 3.1.0-rc2.

Hi John,

if possible, please open two bug reports at bugs.clamav.net (for race
condition and dazukofs support) and attach your patches there - this
(Continue reading)

John Ogness | 10 Sep 2009 22:46

Re: [PATCH] Clamuko: DazukoFS support + fix reload race

On 2009-09-09, Tomasz Kojm <tkojm <at> clamav.net> wrote:
> if possible, please open two bug reports at bugs.clamav.net (for
> race condition and dazukofs support) and attach your patches there -
> this will help us to better schedule the changes.

Done.

https://wwws.clamav.net/bugzilla/show_bug.cgi?id=1691
https://wwws.clamav.net/bugzilla/show_bug.cgi?id=1692

John Ogness
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

Tomasz Kojm | 10 Sep 2009 23:21
Favicon

Re: [PATCH] Clamuko: DazukoFS support + fix reload race

On Thu, 10 Sep 2009 22:46:25 +0200
John Ogness <dazukocode <at> ogness.net> wrote:

> On 2009-09-09, Tomasz Kojm <tkojm <at> clamav.net> wrote:
> > if possible, please open two bug reports at bugs.clamav.net (for
> > race condition and dazukofs support) and attach your patches there -
> > this will help us to better schedule the changes.
> 
> Done.
> 
> https://wwws.clamav.net/bugzilla/show_bug.cgi?id=1691
> https://wwws.clamav.net/bugzilla/show_bug.cgi?id=1692

Thank you!

--

-- 
   oo    .....         Tomasz Kojm <tkojm <at> clamav.net>
  (\/)\.........         http://www.ClamAV.net/gpg/tkojm.gpg
     \..........._         0DCA5A08407D5288279DB43454822DC8985A444B
       //\   /\              Thu Sep 10 23:21:34 CEST 2009
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

Tillmann Werner | 20 Sep 2009 12:15
Picon
Picon

A portable way to determine the version of libclamav

Hi list,

does anybody know of a portable way to determine the version of
libclamav? I'd like to link against it on different platforms that use
different versions of library in their application repositories. That
means I have to support the old (e.g. v0.94) and the new (e.g. 0.95.2)
interface.

From my perspective, best would be to have version information in
clamav.h and then use #ifdef's to distinguish between the different
APIs. Unfortunately, clamav.h seems not to contain such info.

I've searched a bit how other projects to it - without success. I am
sure there is a way. Could somebody please point me to it?

Thanks alot.

Tillmann
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

Török Edwin | 20 Sep 2009 12:38
Picon

Re: A portable way to determine the version of libclamav

On 2009-09-20 13:15, Tillmann Werner wrote:
> Hi list,
>
> does anybody know of a portable way to determine the version of
> libclamav? I'd like to link against it on different platforms that use
> different versions of library in their application repositories. That
> means I have to support the old (e.g. v0.94) and the new (e.g. 0.95.2)
> interface.
>
> From my perspective, best would be to have version information in
> clamav.h and then use #ifdef's to distinguish between the different
> APIs. Unfortunately, clamav.h seems not to contain such info.
>
> I've searched a bit how other projects to it - without success. I am
> sure there is a way. Could somebody please point me to it?
>
>   

You could use one of the macros that are defined in 0.95 and not in
0.94, such as CL_INIT_DEFAULT.

#ifdef CL_INIT_DEFAULT
// ... code for 0.95+ API
#else
// .. code for  <0.95 API
#endif

And if you use cl_init for 0.95+ API (as you should), then if there is a
mismatch between the headers and the library (for example 0.95 headers
and 0.94 libraries), then you'll get a linker error about cl_init not
(Continue reading)

Tillmann Werner | 20 Sep 2009 12:45
Picon
Picon

Re: A portable way to determine the version of libclamav

> You could use one of the macros that are defined in 0.95 and not in
> 0.94, such as CL_INIT_DEFAULT.

That should do it, thanks alot.

Tillmann
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net


Gmane