Mailing List Archive

[clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload
Hi all,
I've managed to compile clamav 0.102.2 on solaris 10.

clamd and clamav-milter are able to start, but if I run a freshclam ( to
get new database definition ) it starts downloading several files and then
it remain stuck on:

LibClamAV debug: Initialized 0.102.2 engine
LibClamAV debug: in cli_cvdload()
LibClamAV debug: MD5(.tar.gz) = ca37a0074e1887418b1d8fa203f920f3
LibClamAV debug: cli_versig: Decoded signature:
ca37a0074e1887418b1d8fa203f920f3
LibClamAV debug: cli_versig: Digital signature is correct.
LibClamAV debug: in cli_tgzload()

for ever.

By trussing the process it seems that it is in an endless loop:
19866: llseek(4, 512, SEEK_SET) = 512
19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
19866: llseek(4, 512, SEEK_SET) = 512
19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
19866: llseek(4, 512, SEEK_SET) = 512
19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192

( and repeat this forever ).

Any idea ?

thx

Pierluigi
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
Just out of curiosity, is Solaris still a thing or are you just playing
around? No offend, I'm seroiusly interested to get some insight on solaris
use cases.

Stefan

Am Freitag, 20. März 2020 schrieb Pierluigi Frullani via clamav-users <
clamav-users@lists.clamav.net>:
> Hi all,
> I've managed to compile clamav 0.102.2 on solaris 10.
> clamd and clamav-milter are able to start, but if I run a freshclam ( to
get new database definition ) it starts downloading several files and then
it remain stuck on:
> LibClamAV debug: Initialized 0.102.2 engine
> LibClamAV debug: in cli_cvdload()
> LibClamAV debug: MD5(.tar.gz) = ca37a0074e1887418b1d8fa203f920f3
> LibClamAV debug: cli_versig: Decoded signature:
ca37a0074e1887418b1d8fa203f920f3
> LibClamAV debug: cli_versig: Digital signature is correct.
> LibClamAV debug: in cli_tgzload()
>
> for ever.
> By trussing the process it seems that it is in an endless loop:
> 19866: llseek(4, 512, SEEK_SET) = 512
> 19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
> 19866: llseek(4, 512, SEEK_SET) = 512
> 19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
> 19866: llseek(4, 512, SEEK_SET) = 512
> 19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
>
> ( and repeat this forever ).
> Any idea ?
> thx
> Pierluigi
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
I do work quite a lot on Solaris either on my personal systems than on
several customer.
Solaris 10 to 11, and sparc, but I also have some customer with solaris on
x86 .

Pierluigi
On Fri, Mar 20, 2020 at 7:00 PM Stefan Bauer <cubewerk@gmail.com> wrote:

> Just out of curiosity, is Solaris still a thing or are you just playing
> around? No offend, I'm seroiusly interested to get some insight on solaris
> use cases.
>
> Stefan
>
>
>
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
On 21/03/2020 05:00, Stefan Bauer via clamav-users wrote:
> Just out of curiosity, is Solaris still a thing or are you just playing
> around? No offend, I'm seroiusly interested to get some insight on
> solaris use cases.
>
I use Solaris - 11.3 on x64 at the moment - for my internet facing
stuff, as it's a little less script-kiddie attractive.

Plus I am an ancient BOFH who started out on BSD 4.0 (on a VAX called
munnari :-) ) and all those old 16- and 32-bit systems, PDP-5/8/11,
VAXen of various ilk, m68K-based system, 16-bit HP MPE systems, la la la
la la la :->

Cheers,
Gary B-)

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
I've tried to understand better where is stuck.

The problem is in cli_tgzload ( and that was the easy part ):

during the while loop I see that it continuously loop on:

LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992

Any idea ?


On Fri, Mar 20, 2020 at 5:45 PM Pierluigi Frullani <
pierluigi.frullani@gmail.com> wrote:

> Hi all,
> I've managed to compile clamav 0.102.2 on solaris 10.
>
> clamd and clamav-milter are able to start, but if I run a freshclam ( to
> get new database definition ) it starts downloading several files and then
> it remain stuck on:
>
> LibClamAV debug: Initialized 0.102.2 engine
> LibClamAV debug: in cli_cvdload()
> LibClamAV debug: MD5(.tar.gz) = ca37a0074e1887418b1d8fa203f920f3
> LibClamAV debug: cli_versig: Decoded signature:
> ca37a0074e1887418b1d8fa203f920f3
> LibClamAV debug: cli_versig: Digital signature is correct.
> LibClamAV debug: in cli_tgzload()
>
> for ever.
>
> By trussing the process it seems that it is in an endless loop:
> 19866: llseek(4, 512, SEEK_SET) = 512
> 19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
> 19866: llseek(4, 512, SEEK_SET) = 512
> 19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
> 19866: llseek(4, 512, SEEK_SET) = 512
> 19866: read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192) = 8192
>
> ( and repeat this forever ).
>
> Any idea ?
>
> thx
>
> Pierluigi
>
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
Hi Pierluigi,

Had a quick look at an older version of the code. It probably has not
changed too much.

To loop as described, it means that fseek() and ftell() are not working
properly in libclamav/cvd.c.

Just looking at the definitions of the types, there may be an issue with
'size' and 'pad' not getting properly passed to fseek().

Try changing the fseek() at the bottom of the loop to cast 'sise' to
long before adding pad in the fseek() call and see what happens. e.g.

fseek(dbio->fs, (long)size + pad, SEEK_CUR);

Also change the code to check the value returned by fseek(). It should
be returning 0.

If the cast works then it would be a good idea to try and make 'size'
and 'pad' 'unsigned long' instead of 'unsigned int'.

Hope this helps.

Regards
Mark.

On 21/03/2020 13:41, Pierluigi Frullani via clamav-users wrote:
> I've tried to understand better where is stuck.
>
> The problem is in cli_tgzload ( and that was the easy part ):
>
> during the while loop I see that it continuously loop on:
>
> LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
> LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
>
> Any idea ?
>
>
> On Fri, Mar 20, 2020 at 5:45 PM Pierluigi Frullani
> <pierluigi.frullani@gmail.com <mailto:pierluigi.frullani@gmail.com>> wrote:
>
> Hi all,
>  I've managed to compile clamav 0.102.2 on solaris 10.
>
> clamd and clamav-milter are able to start, but if I run a freshclam
> ( to get new database definition ) it starts downloading several
> files and then it remain stuck on:
>
> LibClamAV debug: Initialized 0.102.2 engine
> LibClamAV debug: in cli_cvdload()
> LibClamAV debug: MD5(.tar.gz) = ca37a0074e1887418b1d8fa203f920f3
> LibClamAV debug: cli_versig: Decoded signature:
> ca37a0074e1887418b1d8fa203f920f3
> LibClamAV debug: cli_versig: Digital signature is correct.
> LibClamAV debug: in cli_tgzload()
>
> for ever.
>
> By trussing the process it seems that it is in an endless loop:
> 19866:  llseek(4, 512, SEEK_SET)                        = 512
> 19866:  read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192)     = 8192
> 19866:  llseek(4, 512, SEEK_SET)                        = 512
> 19866:  read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192)     = 8192
> 19866:  llseek(4, 512, SEEK_SET)                        = 512
> 19866:  read(4, "1F8B\b\0\0\0\0\00203ECBD".., 8192)     = 8192
>
> ( and repeat this forever ).
>
> Any idea ?
>
> thx
>
> Pierluigi
>
>
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
>

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
Hi Mark
thanks for your input.
Didn't work though :(
I've put a bit of debug messages to see where it is passing and it always
pass in the "compr" check:

pad = size % TAR_BLOCKSIZE ? (TAR_BLOCKSIZE - (size %
TAR_BLOCKSIZE)) : 0;
if (compr) {
if (off == gzseek(dbio->gzs, 0, SEEK_CUR)) {
gzsek = gzseek(dbio->gzs, (long)size + pad, SEEK_CUR);
printf("gzseek \n");
}
else if (pad) {
gzseek(dbio->gzs, pad, SEEK_CUR);
printf("pad gzseek \n");
}
Now the loop says:
LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
gzseek
LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
gzseek

so it's in the first part of the "if".
Thinking it could have been a problem with gzseek I've added the "gzsek"
variable so I can check the return value:
if ( gzsek == -1 )
break;

but it stays in loop.
So it could eventually be a problem with the libz library ....

I've filed a bug to bugzilla, but try to find also by myself.

Pierluigi
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
On 22/03/2020 09:18, Pierluigi Frullani via clamav-users wrote:
> Hi Mark
>   thanks for your input.
> Didn't work though :(
> I've put a bit of debug messages to see where it is passing and it
> always pass in the "compr" check:
>
>         pad = size % TAR_BLOCKSIZE ? (TAR_BLOCKSIZE - (size %
> TAR_BLOCKSIZE)) : 0;
>         if (compr) {
>             if (off == gzseek(dbio->gzs, 0, SEEK_CUR)) {
>                 gzsek = gzseek(dbio->gzs, (long)size + pad, SEEK_CUR);
>                 printf("gzseek \n");
>             }
>             else if (pad) {
>                 gzseek(dbio->gzs, pad, SEEK_CUR);
>                 printf("pad gzseek \n");
>             }
> Now the loop says:
>  LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
> gzseek
> LibClamAV debug: cli_tgzload: Loading COPYING, size: 17992
> gzseek
>
> so it's in the first part of the "if".
> Thinking it could have been a problem with gzseek I've added the "gzsek"
> variable so I can check the return value:
>         if ( gzsek == -1 )
>            break;
>
> but it stays in loop.
> So it could eventually be a problem with the libz library ....
>
> I've filed a bug to bugzilla, but try to find also by myself.
>

Solaris 10 has libz 1.2.3 - you might want to build the latest version
(1.2.8?) and use that, I have vague memories that some newer source (not
just clamav) just doesn't work with the older versions.

Cheers,
Gary B-)

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
Gary,
I've installed the libz to 1.2.8 ( via opencsw packages ) but when I check
for the libz I get:
-bash-3.2# ldd /usr/local/clamav/bin/freshclam | grep libz
libz.so.1 => /opt/csw/lib/libz.so.1
libz.so.1 => /usr/lib/libz.so.1
libz.so.1 (SUNW_1.1) => (version not found)
libz.so.1 => /opt/csw/lib/sparcv8plus+vis/libz.so.1
-bash-3.2#

The config option I've used are:
$ ./configure --enable-milter --prefix=/usr/local/clamav
--sysconfdir=/etc --with-openssl=/opt/csw/ --with-pcre=/usr/local
--with-zlib=/opt/csw --with-libcurl=/opt/csw/

And here the summary from configure:
configure: Summary of detected features follows
OS : solaris2.10
pthreads : yes (-lpthread)
configure: Summary of miscellaneous features
check : no (auto)
fanotify : no (disabled)
fdpassing : n/a
IPv6 : yes
openssl : /opt/csw/
libcurl : /opt/csw/
configure: Summary of optional tools
clamdtop : no (missing ncurses / pdcurses) (disabled)
milter : yes (-lmilter -lsocket -lresolv -lpthread)
clamsubmit : no (missing libjson-c-dev. Use the website to
submit FPs/FNs.) (disabled)
clamonacc : no (auto)
configure: Summary of engine performance features
release mode: yes
llvm : no (disabled)
mempool : yes
configure: Summary of engine detection features
iconv : no
bzip2 : ok
zlib : yes (zlib found at /opt/csw/)
unrar : yes
preclass : no (missing libjson-c-dev) (disabled)
pcre : /usr/local
libmspack : yes (Internal)
libxml2 : yes, from /usr
yara : yes
fts : yes (internal, libc's is not LFS compatible)

-bash-3.2# ls -l /opt/csw/lib/libz.so.1*
lrwxrwxrwx 1 root root 13 Aug 14 2018
/opt/csw/lib/libz.so.1 -> libz.so.1.2.8
-rwxr-xr-x 1 root bin 134060 Sep 23 2013
/opt/csw/lib/libz.so.1.2.8

I don't understand why it's linking both libz ( from the /opt/csw and from
/usr/lib which is the solaris default libz )



On Sun, Mar 22, 2020 at 3:58 AM Gary R. Schmidt <grschmidt@acm.org> wrote:

>
> Solaris 10 has libz 1.2.3 - you might want to build the latest version
> (1.2.8?) and use that, I have vague memories that some newer source (not
> just clamav) just doesn't work with the older versions.
>
> Cheers,
> Gary B-)
>
>
>
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
On 22/03/2020 19:57, Pierluigi Frullani via clamav-users wrote:
>
> Gary,
> I've installed the libz to 1.2.8 ( via opencsw packages ) but when I
> check for the libz I get:
> -bash-3.2# ldd /usr/local/clamav/bin/freshclam | grep libz
>         libz.so.1 =>     /opt/csw/lib/libz.so.1
>         libz.so.1 =>     /usr/lib/libz.so.1
>         libz.so.1 (SUNW_1.1) =>  (version not found)
>         libz.so.1 =>     /opt/csw/lib/sparcv8plus+vis/libz.so.1
> -bash-3.2#
>
> The config option I've used are:
>   $ ./configure --enable-milter --prefix=/usr/local/clamav
> --sysconfdir=/etc --with-openssl=/opt/csw/ --with-pcre=/usr/local
> --with-zlib=/opt/csw --with-libcurl=/opt/csw/
>
> And here the summary from configure:
> configure: Summary of detected features follows
>               OS          : solaris2.10
>               pthreads    : yes (-lpthread)
> configure: Summary of miscellaneous features
>               check       : no (auto)
>               fanotify    : no (disabled)
>               fdpassing   : n/a
>               IPv6        : yes
>               openssl     : /opt/csw/
>               libcurl     : /opt/csw/
> configure: Summary of optional tools
>               clamdtop    : no (missing ncurses / pdcurses) (disabled)
>               milter      : yes (-lmilter  -lsocket -lresolv -lpthread)
>               clamsubmit  : no (missing libjson-c-dev. Use the website
> to submit FPs/FNs.) (disabled)
>               clamonacc   : no (auto)
> configure: Summary of engine performance features
>               release mode: yes
>               llvm        : no (disabled)
>               mempool     : yes
> configure: Summary of engine detection features
>               iconv       : no
>               bzip2       : ok
>               zlib        : yes (zlib found at /opt/csw/)
>               unrar       : yes
>               preclass    : no (missing libjson-c-dev) (disabled)
>               pcre        : /usr/local
>               libmspack   : yes (Internal)
>               libxml2     : yes, from /usr
>               yara        : yes
>               fts         : yes (internal, libc's is not LFS compatible)
>
> -bash-3.2# ls -l /opt/csw/lib/libz.so.1*
> lrwxrwxrwx   1 root     root          13 Aug 14  2018
> /opt/csw/lib/libz.so.1 -> libz.so.1.2.8
> -rwxr-xr-x   1 root     bin       134060 Sep 23  2013
> /opt/csw/lib/libz.so.1.2.8
>
> I don't understand why it's linking both libz ( from the /opt/csw and
> from /usr/lib which is the solaris default libz )
>
It's the "libxml2 : yes, from /usr" that is pulling in the system
libz, grab the OpenCSW libxml2, and keep replacing system libraries,
libcurl, frex, until it all goes away.

Cheers,
Gary B-)

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] freshclam in clamav 0.102.2 stuck in cli_tgzload [ In reply to ]
That fixed the problem.
I had to install quit a lot of dependencies but at the end this really was
the problem.

Thanks a lot !


Pierluigi

On Sun, Mar 22, 2020 at 10:26 AM Gary R. Schmidt <grschmidt@acm.org> wrote:

> It's the "libxml2 : yes, from /usr" that is pulling in the system
> libz, grab the OpenCSW libxml2, and keep replacing system libraries,
> libcurl, frex, until it all goes away.
>
> Cheers,
> Gary B-)
>
>
>