ecap_clamav_adapter-0.2.1 - Segment Violation when loading

Bug #1025567 reported by Peter Gastinger
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
eCAP
Fix Released
Undecided
Alex Rousskov

Bug Description

Hi,

I could not find a better place for this bug report about the clamav ecap adapter from http://www.e-cap.org ...

I compiled squid 3.2.0.18 on my Ubuntu 12.04 (KVM host with 1GB RAM, 8 virtual CPUs):
Linux test 3.2.0-25-virtual #40-Ubuntu SMP Wed May 23 22:20:17 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

, with following options:
root@test:~# squid -v
Squid Cache: Version 3.2.0.18
configure options: '--enable-ssl' '--enable-icap-client' '--sysconfdir=/etc/squid' '--enable-async-io' '--enable-snmp' '--enable-poll' '--with-maxfd=32768' '--enable-storeio=aufs' '--enable-removal-policies=heap,lru' '--enable-epoll' '--disable-ident-lookups' '--enable-truncate' '--with-logdir=/var/log/squid' '--with-pidfile=/var/run/squid.pid' '--with-default-user=squid' '--prefix=/opt/squid' '-enable-negotiate-auth-helpers=squid_kerb_auth' '--enable-linux-netfilter' '--enable-ecap' '--with-valgrind-debug' '--enable-leakfinder' --enable-ltdl-convenience

Everytime I try to start my Squid, it dies with following message:
2012/07/17 10:16:36.889| Loading Squid module from '/usr/local/lib/ecap_clamav_adapter.so'
FATAL: Received Segment Violation...dying.
2012/07/17 10:16:36.889| Closing HTTP port [::]:3128

the squid config part looks like that:
ecap_enable on
adaptation_send_client_ip on
loadable_modules /usr/local/lib/ecap_clamav_adapter.so
ecap_service eservice_req reqmod_precache uri=ecap://e-cap.org/ecap/services/clamav?mode=REQMOD on_error=allow
ecap_service eservice_resp respmod_precache uri=ecap://e-cap.org/ecap/services/clamav?mode=RESPMOD on_error=block
adaptation_service_set reqFilter eservice_req
adaptation_service_set respFilter eservice_resp

Other ecap-Adapters (I tried http://squid-ecap-av.sourceforge.net/) are working.

root@test:/opt/squid/var/cache/squid# file /usr/local/lib/ecap_clamav_adapter.*
/usr/local/lib/ecap_clamav_adapter.a: current ar archive
/usr/local/lib/ecap_clamav_adapter.la: libtool library file,
/usr/local/lib/ecap_clamav_adapter.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x8f31fc9b200ec2b275fb215507b530e028bc112b, not stripped

root@test:/opt/squid/var/cache/squid# ls -lash /usr/local/lib/libecap.*
612K -rw-r--r-- 1 root root 610K Jul 16 14:40 /usr/local/lib/libecap.a
4.0K -rwxr-xr-x 1 root root 935 Jul 16 14:40 /usr/local/lib/libecap.la
   0 lrwxrwxrwx 1 root root 16 Jul 16 14:40 /usr/local/lib/libecap.so -> libecap.so.2.0.0
   0 lrwxrwxrwx 1 root root 16 Jul 16 14:40 /usr/local/lib/libecap.so.2 -> libecap.so.2.0.0
284K -rwxr-xr-x 1 root root 281K Jul 16 14:40 /usr/local/lib/libecap.so.2.0.0

My gdb backtrace:

root@test:/opt/squid/var/cache/squid# gdb squid core
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /opt/squid/sbin/squid...done.
[New LWP 10173]

warning: Can't read pathname for load map: Input/output error.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `squid -X -N'.
Program terminated with signal 6, Aborted.
#0 0x00007fdb06189445 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
64 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb)
(gdb) bt
#0 0x00007fdb06189445 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007fdb0618cbab in __GI_abort () at abort.c:91
#2 0x00000000005c8d5b in death (sig=<optimized out>) at tools.cc:388
#3 <signal handler called>
#4 0x00007fdb06abff2b in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007fdb054f83c6 in Adapter::Service::Service (this=0x2615480, aMode=...) at Service.cc:39
#6 0x00007fdb054f7cdd in Register (mode=...) at Adapter.cc:12
#7 0x00007fdb054f7d29 in __static_initialization_and_destruction_0 (__priority=65535, __initialize_p=1) at Adapter.cc:16
#8 _GLOBAL__sub_I_Adapter.cc(void) () at Adapter.cc:17
#9 0x00007fdb07b86306 in call_init (l=<optimized out>, argc=3, argv=0x7fff52e75b58, env=0x7fff52e75b78) at dl-init.c:85
#10 0x00007fdb07b863df in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:52
#11 _dl_init (main_map=0x2609630, argc=3, argv=0x7fff52e75b58, env=0x7fff52e75b78) at dl-init.c:134
#12 0x00007fdb07b8aada in dl_open_worker (a=0x7fff52e75500) at dl-open.c:549
#13 0x00007fdb07b86176 in _dl_catch_error (objname=0x7fff52e75548, errstring=0x7fff52e75550, mallocedp=0x7fff52e7555f, operate=0x7fdb07b8a700 <dl_open_worker>, args=0x7fff52e75500) at dl-error.c:178
#14 0x00007fdb07b8a31a in _dl_open (file=0x26092f0 "/usr/local/lib/ecap_clamav_adapter.so", mode=-2147483647, caller_dlopen=0x6e5857, nsid=-2, argc=3, argv=<optimized out>, env=0x7fff52e75b78) at dl-open.c:639
#15 0x00007fdb06d20f26 in dlopen_doit (a=0x7fff52e75720) at dlopen.c:67
#16 0x00007fdb07b86176 in _dl_catch_error (objname=0x26093f0, errstring=0x26093f8, mallocedp=0x26093e8, operate=0x7fdb06d20ec0 <dlopen_doit>, args=0x7fff52e75720) at dl-error.c:178
#17 0x00007fdb06d2152f in _dlerror_run (operate=0x7fdb06d20ec0 <dlopen_doit>, args=0x7fff52e75720) at dlerror.c:164
#18 0x00007fdb06d20fc1 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:88
#19 0x00000000006e5857 in vm_open (loader_data=<optimized out>, filename=<optimized out>, advise=<optimized out>) at loaders/dlopen.c:194
#20 0x00000000006e2f3a in tryall_dlopen (phandle=<optimized out>, filename=0x26092f0 "/usr/local/lib/ecap_clamav_adapter.so", advise=0x0, vtable=0x0) at ltdl.c:434
#21 0x00000000006e43f9 in try_dlopen (phandle=0x7fff52e75878, filename=<optimized out>, ext=<optimized out>, advise=0x0) at ltdl.c:1454
#22 0x00000000006e4be4 in lt_dlopenadvise (filename=0x24c51e0 "/usr/local/lib/ecap_clamav_adapter.so", advise=0x0) at ltdl.c:1641
#23 0x00000000005dc251 in openModule (mode=<optimized out>, this=0x25a5580) at LoadableModule.cc:70
#24 LoadableModule::load (this=<optimized out>, mode=<optimized out>) at LoadableModule.cc:50
#25 0x00000000005dc513 in LoadModule (fname=0x2163430 "/usr/local/lib/ecap_clamav_adapter.so") at LoadableModules.cc:12
#26 LoadableModulesConfigure (names=<optimized out>) at LoadableModules.cc:23
#27 0x0000000000581e12 in mainInitialize () at main.cc:1141
#28 SquidMain (argc=<optimized out>, argv=<optimized out>) at main.cc:1459
#29 0x00000000004d0416 in SquidMainSafe (argv=<optimized out>, argc=<optimized out>) at main.cc:1215
#30 main (argc=<optimized out>, argv=<optimized out>) at main.cc:1207

Any ideas anyone?

thanks and best regards,
Peter

Tags: clamav
Revision history for this message
Alex Rousskov (rousskov) wrote :

Please try the attached eCAP ClamAV adapter patch and let me know whether it solves the problem. The patch compiles but I have not tested it as I cannot easily reproduce the bug in my environment anyway.

Changed in ecap:
assignee: nobody → Alex Rousskov (rousskov)
status: New → In Progress
Alex Rousskov (rousskov)
summary: - ecap_clamav_adapter-0.2.1 - Segment Violation
+ ecap_clamav_adapter-0.2.1 - Segment Violation when loading
Revision history for this message
Peter Gastinger (peter-gastinger) wrote :

thanks for the fast response, this patch indeed fixes my problem, thanks.

one last related question, in your opinion, is ecap the best way with the best performance to integrate anti virus protection with squid? Or do you recommend ICAP service/HAVP/...?

Alex Rousskov (rousskov)
Changed in ecap:
status: In Progress → Fix Committed
Alex Rousskov (rousskov)
Changed in ecap:
milestone: none → 1.0.0
Alex Rousskov (rousskov)
tags: added: clamav
Alex Rousskov (rousskov)
Changed in ecap:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.