Bug 81104 - Bus error in Amanda 2.4.5 /usr/local/libexec/planner
Summary: Bus error in Amanda 2.4.5 /usr/local/libexec/planner
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Sam Lawrance
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-16 12:30 UTC by Laurent DAVERIO
Modified: 2005-07-30 17:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent DAVERIO 2005-05-16 12:30:02 UTC
	The Amanda Server port (misc/amanda-server) was recently upgraded from 2.4.4p4 to 2.4.5. While 2.4.4 and previous version worked
perfectly, 2.4.5 is unable to backup any data.

	Although amcheck reports that everything is correct, amdump returns immediately, without backing up any data. amdump's mail report
indicates that this is because the planner returned an empty list. The debug files in /tmp/amanda (amandad.*.debug) also indicate
that planner exited with signal 10. And effectively, trying to run /usr/local/libexec/planner manually produces a bus error.

Fix: 

Workaround : revert to Amanda Server 2.4.4p4 

	For cvsup, I replaced the line  : *default release=cvs tag=.

	with : *default release=cvs tag=. date=2005.05.01.00.00.00

	in my cvsupfile, as the amanda-server port was upgraded to 2.4.5 around 5th May 2005.
How-To-Repeat: 
	Just run /usr/local/sbin/amdump ou /usr/local/libexec/planner from the command line.
Comment 1 David Lay 2005-05-19 01:42:29 UTC
I've struck this problem as well and have been able to do some
rudimentary investigation.

Under FreeBSD 5.4-RELEASE I can *not* reproduce the problem.  Amanda
2.4.5 seems to work fine with FreeBSD 5.

Under FreeBSD 4.11-RELEASE-p8 I can reproduce the problem, so perhaps
the problem is confined to just FreeBSD 4.

Experimenting with the broken port under FreeBSD 4, I was able to
produce a different failure mode by varying compiler optimisation flags.
Originally I had "CFLAGS= -O -pipe" in /etc/make.conf.  With these
compiler flags Amanda 2.4.5 would fail with bus error in planner.

After rebuilding with "-O" removed from CFLAGS, the planner seemed to
exit successfully, but the dump run would still fail with some other
Amanda process exiting on a segmentation fault.  I haven't been able to
identify which process/executable was copping the segfault.

-- 
David Lay
dsl@webize.com.au
Comment 2 Per olof Ljungmark 2005-06-08 21:06:06 UTC
Reproduced here as well on 4.11-REL and 4.11-STABLE from yesterday

Starting program: /usr/local/libexec/amanda/planner mars
(no debugging symbols found)...(no debugging symbols found)...(no 
debugging symbols found)...(no debugging symbols found)...
planner: pid 42151 executable /usr/local/libexec/amanda/planner version 
2.4.5
planner: build: VERSION="Amanda-2.4.5"
planner:        BUILT_DATE="Tue Jun 7 01:05:26 CEST 2005"
planner:        BUILT_MACH="FreeBSD candyman.i.inter-sonic.com 
4.11-RELEASE FreeBSD 4.11-RELEASE #0: Mon Mar 21 13:23:56 CET 2005 
peo@candyman.i.inter-sonic.com:/usr/obj/usr/src/sys/CANDYMAN i386"
planner:        CC="cc"
planner:        CONFIGURE_COMMAND="'./configure' 
'--libexecdir=/usr/local/libexec/amanda' '--with-amandahosts' 
'--with-fqdn' '--with-dump-honor-nodump' '--with-buffered-dump' 
'--without-server' '--disable-libtool' '--prefix=/usr/local' 
'--with-user=operator' '--with-group=operator' 
'--with-gnutar-listdir=/usr/local/var/amanda/gnutar-lists' 
'--prefix=/usr/local' '--build=i386-portbld-freebsd4.11'"
planner: paths: bindir="/usr/local/bin" sbindir="/usr/local/sbin"
planner:        libexecdir="/usr/local/libexec/amanda"
planner:        mandir="/usr/local/man" AMANDA_TMPDIR="/tmp/amanda"
planner:        AMANDA_DBGDIR="/tmp/amanda"
planner:        CONFIG_DIR="/usr/local/etc/amanda" DEV_PREFIX="/dev/"
planner:        RDEV_PREFIX="/dev/r" DUMP="/sbin/dump"
planner:        RESTORE="/sbin/restore" VDUMP=UNDEF VRESTORE=UNDEF
planner:        XFSDUMP=UNDEF XFSRESTORE=UNDEF VXDUMP=UNDEF VXRESTORE=UNDEF
planner:        SAMBA_CLIENT="/usr/local/bin/smbclient"
planner:        GNUTAR="/usr/local/bin/gtar" COMPRESS_PATH="/usr/bin/gzip"
planner:        UNCOMPRESS_PATH="/usr/bin/gzip" LPRCMD="/usr/bin/lpr"
planner:        MAILER="/usr/bin/Mail"
planner:        listed_incr_dir="/usr/local/var/amanda/gnutar-lists"
planner: defs:  DEFAULT_SERVER="candyman.i.inter-sonic.com"
planner:        DEFAULT_CONFIG="DailySet1"
planner:        DEFAULT_TAPE_SERVER="candyman.i.inter-sonic.com"
planner:        DEFAULT_TAPE_DEVICE="/dev/null" HAVE_MMAP HAVE_SYSVSHM
planner:        LOCKING=POSIX_FCNTL DEBUG_CODE AMANDA_DEBUG_DAYS=4
planner:        BSD_SECURITY USE_AMANDAHOSTS CLIENT_LOGIN="operator"
planner:        FORCE_USERID HAVE_GZIP COMPRESS_SUFFIX=".gz"
planner:        COMPRESS_FAST_OPT="--fast" COMPRESS_BEST_OPT="--best"
planner:        UNCOMPRESS_OPT="-dc"
(no debugging symbols found)...(no debugging symbols found)...(no 
debugging symbols found)...(no debugging symbols found)...
Program received signal SIGSEGV, Segmentation fault.
0x2818c54a in vfprintf () from /usr/lib/libc.so.4
(gdb) where
#0  0x2818c54a in vfprintf () from /usr/lib/libc.so.4
#1  0x2818b275 in fprintf () from /usr/lib/libc.so.4
#2  0x8049b90 in free ()
#3  0x80498fe in free ()
Comment 3 Sam Lawrance freebsd_committer freebsd_triage 2005-06-25 08:05:38 UTC
Responsible Changed
From-To: freebsd-ports-bugs->lawrance

This PR is mine, baby
Comment 4 tv 2005-07-05 15:53:54 UTC
Hello

It looks like a bug with older gcc. 
System: 4.10-RELEASE-p3
Gcc; 2.95.4

I installed gcc 3.4 (since amanda works with 5.4) on my 4.10 Amanda
machine. I recompiled amanda 2.4.5 with USE_GCC= 3.4 in the Makefile and
everything works fine. Planner no longer dies.

Regards,
Thomas
Comment 5 John E. Hein 2005-07-07 23:21:33 UTC
I just sent a patch & a bit of discussion to amanda-hackers for the
same problem (bus errors from planner).  It's a buffer overflow
introduced in 2.4.5 (also on the main trunk).  This patch fixes it for
me:

--- server-src/infofile.c.orig	Wed Mar 16 11:15:28 2005
+++ server-src/infofile.c	Thu Jul  7 14:12:54 2005
@@ -274,7 +274,7 @@
     rc = 0;
 
     nb_history = 0;
-    for(i=0;i<=NB_HISTORY+1;i++) {
+    for(i=0;i<sizeof(info->history)/sizeof(info->history[0]);i++) {
 	info->history[i].level = -2;
     }
     for(rc = -2; (line = agets(infof)) != NULL; free(line)) {
Comment 6 Sam Lawrance freebsd_committer freebsd_triage 2005-07-30 17:21:41 UTC
State Changed
From-To: open->closed

John's fix was committed.  Thanks all!