| Summary: | /usr/bin/netstat gets bus error with -i -a options | ||
|---|---|---|---|
| Product: | Base System | Reporter: | jim <jim> |
| Component: | bin | Assignee: | Poul-Henning Kamp <phk> |
| Status: | Closed FIXED | ||
| Severity: | Affects Only Me | ||
| Priority: | Normal | ||
| Version: | Unspecified | ||
| Hardware: | Any | ||
| OS: | Any | ||
|
Description
jim
2001-03-28 13:40:01 UTC
On Wed, Mar 28, 2001 at 04:37:13AM -0800, jim@reptiles.org wrote: > > >Number: 26168 > >Category: bin > >Synopsis: /usr/bin/netstat gets bus error with -i -a options > >Originator: Jim Mercer > >Release: 4.3-RC > >Organization: > Reptilian Research > >Environment: > gw# uname -a > FreeBSD gw.reptiles.org 4.3-RC FreeBSD 4.3-RC #0: Tue Mar 27 18:24:41 EST 2001 root@gw.reptiles.org:/usr/src/sys/compile/GENERIC i386 > >Description: > /usr/bin/netstat gets bus error with -i -a options I can confirm this; can you try the attached patch? (multiaddr holds an address in KVM, not in userspace; dereferencing it does not give any meaningful value to the user process). G'luck, Peter -- This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain. Index: src/usr.bin/netstat/if.c =================================================================== RCS file: /home/ncvs/src/usr.bin/netstat/if.c,v retrieving revision 1.32.2.5 diff -u -r1.32.2.5 if.c --- src/usr.bin/netstat/if.c 2001/03/22 13:48:42 1.32.2.5 +++ src/usr.bin/netstat/if.c 2001/03/28 13:14:35 @@ -448,9 +448,10 @@ const char *fmt; LIST_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) { - if (kread(*(u_long *)multiaddr, (char *)&ifma, + if (kread((u_long)multiaddr, (char *)&ifma, sizeof ifma)) break; + multiaddr = &ifma; if (kread((u_long)ifma.ifma_addr, (char *)&msa, sizeof msa)) break; On Wed, Mar 28, 2001 at 04:15:24PM +0300, Peter Pentchev wrote: > On Wed, Mar 28, 2001 at 04:37:13AM -0800, jim@reptiles.org wrote: > > >Number: 26168 > > >Category: bin > > >Synopsis: /usr/bin/netstat gets bus error with -i -a options > > >Originator: Jim Mercer > > >Release: 4.3-RC > > >Organization: > > Reptilian Research > > >Environment: > > gw# uname -a > > FreeBSD gw.reptiles.org 4.3-RC FreeBSD 4.3-RC #0: Tue Mar 27 18:24:41 EST 2001 root@gw.reptiles.org:/usr/src/sys/compile/GENERIC i386 > > >Description: > > /usr/bin/netstat gets bus error with -i -a options > > I can confirm this; can you try the attached patch? > > (multiaddr holds an address in KVM, not in userspace; dereferencing > it does not give any meaningful value to the user process). this patch seems to have fixed it: gw# /usr/bin/netstat -ia Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll xl0 1500 <Link#1> 00:01:02:6e:26:05 498 0 328 0 0 Bus error gw# make install install -c -s -o root -g kmem -m 2555 netstat /usr/bin install -c -o root -g wheel -m 444 netstat.1.gz /usr/share/man/man1 gw# netstat -ia Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll xl0 1500 <Link#1> 00:01:02:6e:26:05 595 0 388 0 0 33:33:5e:86:7b:45 33:33:0:0:0:1 33:33:ff:6e:26:5 1:0:5e:0:0:1 ... faith 1500 <Link#10> > > G'luck, > Peter > > -- > This inert sentence is my body, but my soul is alive, dancing in the sparks of your brain. > > Index: src/usr.bin/netstat/if.c > =================================================================== > RCS file: /home/ncvs/src/usr.bin/netstat/if.c,v > retrieving revision 1.32.2.5 > diff -u -r1.32.2.5 if.c > --- src/usr.bin/netstat/if.c 2001/03/22 13:48:42 1.32.2.5 > +++ src/usr.bin/netstat/if.c 2001/03/28 13:14:35 > @@ -448,9 +448,10 @@ > const char *fmt; > > LIST_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) { > - if (kread(*(u_long *)multiaddr, (char *)&ifma, > + if (kread((u_long)multiaddr, (char *)&ifma, > sizeof ifma)) > break; > + multiaddr = &ifma; > if (kread((u_long)ifma.ifma_addr, (char *)&msa, > sizeof msa)) > break; -- [ Jim Mercer jim@pneumonoultramicroscopicsilicovolcanoconiosis.ca ] [ Reptilian Research -- Longer Life through Colder Blood ] [ aka jim@reptiles.org +1 416 410-5633 ] Responsible Changed From-To: freebsd-bugs->des It seems that DES introduced the wrong dereferencing of multiaddr in the TAILQ changeover in rev. 1.32.2.5. <<On Wed, 28 Mar 2001 05:20:02 -0800 (PST), Peter Pentchev <roam@orbitel.bg> said: > LIST_FOREACH(multiaddr, &ifnet.if_multiaddrs, ifma_link) { > - if (kread(*(u_long *)multiaddr, (char *)&ifma, > + if (kread((u_long)multiaddr, (char *)&ifma, > sizeof ifma)) > break; > + multiaddr = &ifma; Yet another reason why the LIST_FOREACH macro is an utter botch. -GAWollman Responsible Changed From-To: des->phk I backed out part of my MFC, so it works again in -STABLE, but it's still broken in -CURRENT. Pass it on to phk, who broke it in the first place. State Changed From-To: open->closed Fixed, thanks! |