You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Micah Anderson <mi...@riseup.net> on 2008/05/21 17:16:31 UTC

Compiling with tcc, cannot start: segfaults

I chased this around for a while and when I finally determined the
cause, I figured I should post something so that future searchers will
find it.

I have been happily running 3.2.3-0.volatile1 (Debian) for months. Today 
I woke up to a lot of Spam in my INBOX, and spamassassin down. It seems
to have died during the cron sa-update process, so I try to start it up
again and I'm unable to start spamd, it segfaults when I do:

Starting SpamAssassin Mail Filter Daemon:
/etc/init.d/spamassassin: line 38: 11186 Segmentation fault      start-stop-daemon --start
--pidfile $PIDFILE --exec $XNAME $NICE --oknodo --startas $DAEMON -- $OPTIONS $DOPTIONS

Those options come from the Debian initscript, if I unpack them and run
it manually:

# /usr/sbin/spamd OPTIONS="-i -u nobody -A
10.0.1.13,10.0.1.15,10.0.1.17,10.0.1.31,10.0.1.33,10.0.1.44 -q -x
--max-children 50 --helper-home-dir /etc/spamassassin"
Segmentation fault

Even without all the options:
# /usr/sbin/spamd
Segmentation fault

In fact, if I try to sa-compile, I get a segfault, if I purge the
3.002003 rules (and their compiled versions), re-run sa-update and then
sa-compile and then try to start spamassassin again, it segfaults

If I strace the process, the end is as follows:

stat64("/var/lib/spamassassin/compiled/3.002003/Mail/SpamAssassin/CompiledRegexps/body_0.pmc",
0xbfa315ac) = -1 ENOENT (No such file or directory)
stat64("/var/lib/spamassassin/compiled/3.002003/Mail/SpamAssassin/CompiledRegexps/body_0.pm",
{st_mode=S_IFREG|0444, st_size=58745, ...}) = 0
open("/var/lib/spamassassin/compiled/3.002003/Mail/SpamAssassin/CompiledRegexps/body_0.pm",
O_RDONLY|O_LARGEFILE) = 7
ioctl(7, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfa312c8) = -1 ENOTTY
(Inappropriate ioctl for device)
_llseek(7, 0, [0], SEEK_CUR)            = 0
read(7, "\npackage Mail::SpamAssassin::Com"..., 4096) = 4096
read(7, "razine\\b/i#,\n  q#__DRUGS_DIET5# "..., 4096) = 4096
read(7, "SPUR-M\\b/i#,\n  q#FB_SSEX# => q#/"..., 4096) = 4096
read(7, "#,\n  q#__FRAUD_WNY# => q#/\\b(?:d"..., 4096) = 4096
read(7, "SOR# => q#/not a registered inve"..., 4096) = 4096
read(7, "a stud/i#,\n  q#SARE_BETTERORG# ="..., 4096) = 4096
read(7, "|05 E(?:ast|\\.)? 85th St|10 S\\. "..., 4096) = 4096
read(7, " Blvd Suite 200|491 North Federa"..., 4096) = 4096
read(7, "RE_EN_N_800_5_1# => q#/800\\W+5(?"..., 4096) = 4096
read(7, " a|an? honest|you being a|to any"..., 4096) = 4096
read(7, " matter|mutual understanding|rel"..., 4096) = 4096
read(7, "U_PART_CIA# => q#/(?![\\s\"\'-][0-9"..., 4096) = 4096
read(7, " F X|A B S Y|H L U N|F C Y I|A M"..., 4096) = 4096
read(7, "> q#/\\bbuy\\b.{1,30}\\br(?:[0o@]|a"..., 4096) = 4096
read(7, "{0,40}account .{0,40}record/i#,\n"..., 4096) = 1401
brk(0x9c48000)                          = 0x9c48000
stat64("/var/lib/spamassassin/compiled/3.002003/auto/Mail/SpamAssassin/CompiledRegexps/body_0",
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
stat64("/var/lib/spamassassin/compiled/3.002003/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so",
{st_mode=S_IFREG|0555, st_size=1015528, ...}) = 0
stat64("/var/lib/spamassassin/compiled/3.002003/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.bs",
{st_mode=S_IFREG|0444, st_size=0, ...}) = 0
open("/var/lib/spamassassin/compiled/3.002003/auto/Mail/SpamAssassin/CompiledRegexps/body_0/body_0.so",
O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340\\\0"...,512) = 512
fstat64(8, {st_mode=S_IFREG|0555, st_size=1015528, ...}) = 0
mmap2(NULL, 1018080, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8,0) = 0xb77a8000
mmap2(0xb7890000, 69632, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0xe7) = 0xb7890000
mprotect(0xbfa31000, 4096,
PROT_READ|PROT_WRITE|PROT_EXEC|PROT_GROWSDOWN) = 0
close(8)                                = 0
mprotect(0xb77a8000, 950272, PROT_READ|PROT_WRITE) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++
Process 16329 detached

So what was the cause? It turned out, I was trying to be smart and save
disk space by installing the 'tcc' compiler on all of our spam
processing servers. 'tcc' is known as 'the tiny C compiler', its small,
fast and ANSI C compliant. Its somewhat experimental, and as such when I
replaced it with gcc, blew away my compiled rules and re-ran sa-compile,
things were able to start up again fine.

Micah