Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9197 - traceroute generates bus error
Summary: traceroute generates bus error
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal
Assignee: Ric Messier (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-16 08:28 UTC by Ric Messier
Modified: 2003-01-13 19:55 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ric Messier 2002-10-16 08:28:26 UTC
traceroute generates bus error.
mmap(0x7016a000, 14016, PROT_READ|PROT_WRITE|PROT_EXEC,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7016a000
close(3)                                = 0
munmap(0x7001c000, 35947)               = 0
getpagesize()                           = 0x2000
brk(0)                                  = 0x267c0
brk(0x267e0)                            = 0x267e0
brk(0x28000)                            = 0x28000
getpid()                                = 32182
open("/etc/nsswitch.conf", O_RDONLY)    = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=604, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7001a000
read(3, "# Copyright 1999-2002 Gentoo Tec"..., 8192) = 604
read(3, "", 8192)                       = 0
close(3)                                = 0
munmap(0x7001a000, 8192)                = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=35947, ...}) = 0
mmap(NULL, 35947, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7001c000
close(3)                                = 0
open("/lib/v9/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/v9", 0xefffeaf8)           = -1 ENOENT (No such file or directory)
open("/lib/libnss_db.so.2", O_RDONLY)   = -1 ENOENT (No such file or directory)
stat64("/lib", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("/usr/lib/v9/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/v9", 0xefffeaf8)       = -1 ENOENT (No such file or directory)
open("/usr/lib/libnss_db.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib", {st_mode=S_IFDIR|0755, st_size=24576, ...}) = 0
munmap(0x7001c000, 35947)               = 0
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=35947, ...}) = 0
mmap(NULL, 35947, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7001c000
close(3)                                = 0
open("/lib/libnss_files.so.2", O_RDONLY) = 3
read(3, "\177ELF\1\2\1\0\0\0\0\0\0\0\0\0\0\3\0\2\0\0\0\1\0\0\37"..., 1024) = 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=52927, ...}) = 0
mmap(NULL, 108224, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x70170000
mprotect(0x7017a000, 67264, PROT_NONE)  = 0
mmap(0x70180000, 49152, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED,
3, 0) = 0x70180000
close(3)                                = 0
munmap(0x7001c000, 35947)               = 0
open("/etc/protocols", O_RDONLY)        = 3
nfssvc(0x3)                             = 0
nfssvc(0x3)                             = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=1846, ...}) = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x7001a000
read(3, "# /etc/protocols:\n# $Id: protoco"..., 8192) = 1846
close(3)                                = 0
munmap(0x7001a000, 8192)                = 0
open("/dev/null", O_RDONLY)             = 3
open("/dev/null", O_RDONLY)             = 4
open("/dev/null", O_RDONLY)             = 5
socket(PF_INET, SOCK_RAW, IPPROTO_ICMP) = -1 EPERM (Operation not permitted)
write(2, "traceroute: icmp socket: Operati"..., 49traceroute: icmp socket:
Operation not permitted
) = 49
exit(1)
Comment 1 Joshua Kinard gentoo-dev 2002-10-16 23:12:28 UTC
I get the same thing, "Bus Error".  How did you get all that output, though?,
some debugging mode?
Comment 2 Martin Holzer (RETIRED) gentoo-dev 2002-10-18 02:21:23 UTC
strace does it :)

a nice tool

ltrace could also do some nice output
Comment 3 Ferris McCormick (RETIRED) gentoo-dev 2002-10-21 13:20:04 UTC
Look at traceroute.c (main source):  At lines 299--300, hou will see

struct sockaddr_in whereto;	/* Who to try to reach */
struct sockaddr_in wherefrom;	/* Who we are */

Later on, in main() at 364, you will see

	register struct sockaddr_in *from = (struct sockaddr_in*)&wherefrom;
	register struct sockaddr_in *to = (struct sockaddr_in *)&whereto;

Later yet, you will see some calls like this one at 717:

	setsin(from, al->addr);
and finally setsin() at 1340 in its entirety is

void
setsin(register struct sockaddr_in *sin, register u_int32_t addr)
{

	memset(sin, 0, sizeof(*sin));
#ifdef HAVE_SOCKADDR_SA_LEN
	sin->sin_len = sizeof(*sin);
#endif
	sin->sin_family = AF_INET;
	sin->sin_addr.s_addr = addr;    /*  <<<<<< BUS ERROR HERE >>>>>> */
}

The bus error is on the comment; the problem is that the 'struct sockaddr'
is not necessarily aligned in such a way that a 'struct sockaddr_in' can
overlay it and hope to have the fields nicely laid out for sparc.
Comment 4 Ric Messier (RETIRED) gentoo-dev 2002-10-21 13:22:59 UTC
There is a patch that corrects this. It won't currently apply nicely. Working 
on getting it to apply by re-generating the patch.
Comment 5 Ric Messier (RETIRED) gentoo-dev 2002-10-22 07:51:09 UTC
*** traceroute.c.orig   Tue Oct 22 08:09:05 2002
--- traceroute.c        Tue Oct 22 08:10:48 2002
***************
*** 294,305 ****
  u_int32_t gwlist[NGATEWAYS + 1];
  
  int s;                                /* receive (icmp) socket file 
descriptor */
  int sndsock;                  /* send (udp/icmp) socket file descriptor */
  
! struct sockaddr whereto;      /* Who to try to reach */
! struct sockaddr wherefrom;    /* Who we are */
  int packlen;                  /* total length of packet */
  int minpacket;                        /* min ip packet size */
  int maxpacket = 32 * 1024;    /* max ip packet size */
  int pmtu;                     /* Path MTU Discovery (RFC1191) */
  u_int pausemsecs;
--- 294,305 ----
  u_int32_t gwlist[NGATEWAYS + 1];
  
  int s;                                /* receive (icmp) socket file 
descriptor */
  int sndsock;                  /* send (udp/icmp) socket file descriptor */
  
! struct sockaddr_storage whereto;      /* Who to try to reach */
! struct sockaddr_storage wherefrom;    /* Who we are */
  int packlen;                  /* total length of packet */
  int minpacket;                        /* min ip packet size */
  int maxpacket = 32 * 1024;    /* max ip packet size */
  int pmtu;                     /* Path MTU Discovery (RFC1191) */
  u_int pausemsecs;