Subject: port-sparc64/18688: tcpdump bus error on sparc64
To: None <gnats-bugs@gnats.netbsd.org>
From: john heasley <heas@shrubbery.net>
List: netbsd-bugs
Date: 10/18/2002 02:45:36
>Number:         18688
>Category:       port-sparc64
>Synopsis:       tcpdump bus error on sparc64
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-sparc64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Oct 17 19:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     john heasley
>Release:        NetBSD 1.6I
>Organization:
>Environment:
System: NetBSD oak 1.6I NetBSD 1.6I (oak) #9: Thu Oct 17 18:43:09 UTC 2002 root@oak:/home/src/sys/arch/sparc64/compile/oak sparc64
Architecture: sparc64
Machine: sparc64
>Description:
tcpdump dumps core with a bus error in print-*.c, isoclns for example.
problem is that LBL_ALIGN is not defined (from extract.h) resulting
in an unaligned access.
>How-To-Repeat:
use tcpdump on sparc64 to collect IS-IS PDUs.  tcpdump will most
likely get a bus error.

01:38:09.482311 ISIS(1497), 0:d0:6:49:68:1c > 1:80:c2:0:0:15, hlen: 27, v: 1, sys-id-len: 6 (0), max-area: 3 (0), L2 Lan IIH
                  source-id: 1980.5800.5254,  holding time: 10, Level 1, Level 2
                  lan-id:    1980.5800.5254.02, Priority: 64, PDU length: 1497
                    Protocols supported TLV #129, length: 2
                        NLPID(s): CLNS, IPv4
                    Area address(es) TLV #1, length: 14
                        Area address (13): 47.0023.0001.0000.0000.0004.0002
                    IPv4 Interface address(es) TLV #132, length: 4
                        IPv4 interface address: 198.58.5.10

(gdb) whe
#0  0x12ae24 in isis_print (p=0x404123 "\203\e\001", length=1497)
    at /home/src/dist/tcpdump/print-isoclns.c:1932

the value of tptr will be only byte aligned.
>Fix:
define LBL_ALIGN for sparc64.

Index: Makefile
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/tcpdump/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- Makefile	2002/09/18 03:54:38	1.29
+++ Makefile	2002/10/18 02:42:50
@@ -60,6 +60,9 @@
 	-DHAVE_SETLINEBUF=1 -DHAVE_VSNPRINTF=1 -DHAVE_SNPRINTF=1 \
 	-DRETSIGTYPE=void -DRETSIGVAL= -DHAVE_SIGACTION=1 \
 	-DHAVE_SOCKADDR_SA_LEN=1 -DHAVE_H_ERRNO=1
+.if (${MACHINE_ARCH} == "sparc64")
+CPPFLAGS+=-DLBL_ALIGN
+.endif
 #CPPFLAGS+=-DTCPDUMP_DO_SMB=1
 
 .if (${MKCRYPTO} != "no")

>Release-Note:
>Audit-Trail:
>Unformatted: