security/clamav: Segmentation fault when running clamav in a 32-bit jail on a 64-bit host

Glen Barber glen.j.barber at
Fri Aug 27 17:58:29 UTC 2010

On 8/27/10 1:32 PM, Jeremy Chadwick wrote:
>> Of course.  The new backtrace is here:
> I want to make sure I understand the environment -- on a native i386
> (32-bit) FreeBSD host, the software works fine.  But on a native amd64
> (64-bit) FreeBSD host, the software segfaults.  Correct?

The clamav instance runs on a 64-bit host in a 32-bit jail.  In a 32-bit
host/32-bit jail environment, the software runs fine, as you suggest above.

> If so -- it appears as if the system you're providing the backtrace from
> is a 32-bit system, or within a 32-bit environment?  I would expect to
> see 64-bit addresses in the backtrace, yet they're all 32-bit.
> I'm not familiar with jailed environments (or the concept/possibility of
> running a mixed-architecture jail (e.g. 64-bit host OS with 32-bit
> jails)).  I don't use lib32 on my amd64 systems.

To be honest, this is the first non-base software I've had an issue with
in a mixed-arch environment.

> I did take a look at the clamav code itself (I'd have to spend a few
> hundred lines outlining it here and would rather not).  My guess is that
> there's a conflict between what the running OS architecture is and what
> the build process determines the architecture is.
> Given that you have jails, and possibly a mixed architecture environment
> on a single host (e.g. 64-bit host OS with 32-bit jails), can you
> explain exactly how you go about building clamav, followed by how you go
> about running it?

The build is done from ports with no special options excluding the
latest build, being:


The only make.conf entry is PERL_VERSION=5.10.1.

The clamd service runs under djb's supervise (/usr/local/sbin/clamd).
Additionally, port builds were done after setting UNAME_m and UNAME_p
[1], but I haven't had luck with that overriding the machine hardware type.

If this provides any clues, here's what file(1) sees, as well as ldd:

% file /usr/local/sbin/clamd
/usr/local/sbin/clamd: ELF 32-bit LSB executable, Intel 80386, version 1
(FreeBSD), dynamically linked (uses shared libs), for FreeBSD 8.1, not

% ldd /usr/local/sbin/clamd
/usr/local/sbin/clamd: => /usr/local/lib/ (0x280ac000) => /lib/ (0x281f8000) => /usr/lib/ (0x2820a000) => /lib/ (0x2821b000) => /lib/ (0x28235000) => /lib/ (0x2824a000)

[1] -


Glen Barber

More information about the freebsd-ports mailing list