Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Sep 2008 22:31:46 -0400
From:      Mike Tancsa <mike@sentex.net>
To:        "David E. O'Brien" <obrien@freebsd.org>, freebsd-stable@freebsd.org
Subject:   Re: cvs commit: src/usr.bin/netstat Makefile bpf.c inet.c pfkey.c route.c sctp.c
Message-ID:  <200809100231.m8A2VliB098720@lava.sentex.ca>
In-Reply-To: <200809011505.m81F5UwC062968@repoman.freebsd.org>
References:  <200809011505.m81F5UwC062968@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Hi,
         The change below seems to make netstat -B on RELENG_7 coredump
netstat -B

specifically,

-               printf("%5d %6s %7s %9lu %9lu %9lu %5d %5d %s\n",
+               printf("%5d %6s %7s %9ju %9ju %9ju %5d %5d %s\n",


Not sure if its a netstat issue or a libc issue as it works fine in HEAD

0[releng7]# gdb /usr/bin/netstat
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain=
 conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...
(gdb) r -B
Starting program: /usr/bin/netstat -B
   Pid  Netif   Flags      Recv      Drop     Match Sblen Hblen Command

Program received signal SIGSEGV, Segmentation fault.
strlen () at /usr/src/lib/libc/i386/string/strlen.S:48
48              repne                           /* search! */
Current language:  auto; currently asm
(gdb) bt
#0  strlen () at /usr/src/lib/libc/i386/string/strlen.S:48
#1  0x281c5491 in __vfprintf (fp=3D0x281e8798,=20
fmt0=3D0x80671ac "%5d %6s %7s %9ju %9ju %9ju %5d %5d %s\n",
     ap=3D0xbfbfeba4 "\224\020\020\bA\001") at=20
/usr/src/lib/libc/stdio/vfprintf.c:1052
#2  0x281c37e2 in vfprintf (fp=3D0x281e8798,=20
fmt0=3D0x80671ac "%5d %6s %7s %9ju %9ju %9ju %5d=20
%5d %s\n", ap=3D0xbfbfeb74 "A\001")
     at /usr/src/lib/libc/stdio/vfprintf.c:398
#3  0x281ac086 in printf (fmt=3D0x80671ac "%5d %6s=20
%7s %9ju %9ju %9ju %5d %5d %s\n") at /usr/src/lib/libc/stdio/printf.c:49
#4  0x08059dc4 in bpf_stats (ifname=3D0x0) at=
 /usr/src/usr.bin/netstat/bpf.c:123
#5  0x080504a1 in main (argc=3D0, argv=3D0xbfbfec7c)=20
at /usr/src/usr.bin/netstat/main.c:498
(gdb) bt full
#0  strlen () at /usr/src/lib/libc/i386/string/strlen.S:48
No locals.
#1  0x281c5491 in __vfprintf (fp=3D0x281e8798,=20
fmt0=3D0x80671ac "%5d %6s %7s %9ju %9ju %9ju %5d %5d %s\n",
     ap=3D0xbfbfeba4 "\224\020\020\bA\001") at=20
/usr/src/lib/libc/stdio/vfprintf.c:1052
         fmt =3D 0x80671d1 "\n"
         ch =3D 115
         n =3D 1
         n2 =3D 0
         cp =3D 0x38e38e39 <Error reading address 0x38e38e39: Bad address>
         iovp =3D (struct __siov *) 0xbfbfea04
         flags =3D 0
         ret =3D 80
         width =3D 0
         prec =3D -1
         sign =3D 0 '\0'
         thousands_sep =3D 0 '\0'
         grouping =3D 0x0
         decimal_point =3D 0x281e35b4 "."
         signflag =3D 1
         fparg =3D {dbl =3D 0, ldbl =3D 0}
         expt =3D 0
         expchar =3D 0 '\0'
         dtoaend =3D 0x0
         expsize =3D 0
         lead =3D 1
         ndig =3D 50
         expstr =3D "\000\000\000\000\000\000\000"
         dtoaresult =3D 0x0
         nseps =3D 134
         nrepeats =3D 2
         ulval =3D 672080317
         ujval =3D 581017334647357440
         base =3D 10
         dprec =3D 0
         realsz =3D 9
         size =3D 9
         prsize =3D 9
         xdigs =3D 0x0
         uio =3D {uio_iov =3D 0xbfbfe9fc, uio_iovcnt =3D 1, uio_resid =3D 1}
         iov =3D {{iov_base =3D 0x80671ce, iov_len =3D=20
1}, {iov_base =3D 0xbfbfe9f3, iov_len =3D 9},=20
{iov_base =3D 0xbfbfe9fa, iov_len =3D 2}, {
     iov_base =3D 0x0, iov_len =3D 0}, {iov_base =3D=20
0x0, iov_len =3D 0}, {iov_base =3D 0x0, iov_len =3D 0},=20
{iov_base =3D 0x0, iov_len =3D 0}, {
     iov_base =3D 0x0, iov_len =3D 0}}
         buf =3D "\003\000\000\000=FF", '\0' <repeats=20
18 times>, "select\000\000\000root", '\0'=20
<repeats 23 times>, "dhclient", '\0' <rep---Type=20
<return> to continue, or q <return> to quit---
eats 12 times>, "Fre581017334672080317"
         ox =3D "\000"
         argtable =3D (union arg *) 0x0
         statargtable =3D {{intarg =3D 0, uintarg =3D=20
0, longarg =3D 0, ulongarg =3D 0, longlongarg =3D 0,=20
ulonglongarg =3D 0, ptrdiffarg =3D 0,
     sizearg =3D 0, intmaxarg =3D 0, uintmaxarg =3D 0,=20
pvoidarg =3D 0x0, pchararg =3D 0x0, pschararg =3D 0x0,=20
pshortarg =3D 0x0, pintarg =3D 0x0,
     plongarg =3D 0x0, plonglongarg =3D 0x0,=20
pptrdiffarg =3D 0x0, psizearg =3D 0x0, pintmaxarg =3D=20
0x0, doublearg =3D 0, longdoublearg =3D 0,
     wintarg =3D 0, pwchararg =3D 0x0}, {intarg =3D 0,=20
uintarg =3D 0, longarg =3D 0, ulongarg =3D 0, longlongarg =3D 0,=
 ulonglongarg =3D 0,
     ptrdiffarg =3D 0, sizearg =3D 0, intmaxarg =3D 0,=20
uintmaxarg =3D 0, pvoidarg =3D 0x0, pchararg =3D 0x0,=20
pschararg =3D 0x0, pshortarg =3D 0x0,
     pintarg =3D 0x0, plongarg =3D 0x0, plonglongarg=20
=3D 0x0, pptrdiffarg =3D 0x0, psizearg =3D 0x0, pintmaxarg =3D 0x0,=
 doublearg =3D 0,
     longdoublearg =3D <invalid float value>,=20
wintarg =3D 0, pwchararg =3D 0x0}, {intarg =3D 278, uintarg =3D 278, longarg=
 =3D 278,
     ulongarg =3D 278, longlongarg =3D 278,=20
ulonglongarg =3D 278, ptrdiffarg =3D 278, sizearg =3D=20
278, intmaxarg =3D 278, uintmaxarg =3D 278,
     pvoidarg =3D 0x116, pchararg =3D 0x116 <Error=20
reading address 0x116: Bad address>,
     pschararg =3D 0x116 <Error reading address=20
0x116: Bad address>, pshortarg =3D 0x116, pintarg =3D 0x116, plongarg =3D=
 0x116,
     plonglongarg =3D 0x116, pptrdiffarg =3D 0x116,=20
psizearg =3D 0x116, pintmaxarg =3D 0x116, doublearg =3D=
 1.3735024954386654e-321,
     longdoublearg =3D <invalid float value>,=20
wintarg =3D 278, pwchararg =3D 0x116}, {intarg =3D 423,=20
uintarg =3D 423, longarg =3D 423,
     ulongarg =3D 423, longlongarg =3D 137438953895,=20
ulonglongarg =3D 137438953895, ptrdiffarg =3D 423, sizearg =3D 423,
     intmaxarg =3D 137438953895, uintmaxarg =3D 137438953895, pvoidarg =3D=
 0x1a7,
     pchararg =3D 0x1a7 <Error reading address=20
0x1a7: Bad address>, pschararg =3D 0x1a7 <Error=20
reading address 0x1a7: Bad address>,
     pshortarg =3D 0x1a7, pintarg =3D 0x1a7, plongarg=20
=3D 0x1a7, plonglongarg =3D 0x1a7, pptrdiffarg =3D 0x1a7, psizearg =3D=
 0x1a7,
     pintmaxarg =3D 0x1a7, doublearg =3D=20
6.7903865519878482e-313, longdoublearg =3D=20
5.0099241040047100945541003353856387e-4940,
     wintarg =3D 423, pwchararg =3D 0x1a7}, {intarg =3D=20
0, uintarg =3D 0, longarg =3D 0, ulongarg =3D 0, longlongarg =3D 0,=
 ulonglongarg =3D 0,
     ptrdiffarg =3D 0, sizearg =3D 0, intmaxarg =3D 0,=20
uintmaxarg =3D 0, pvoidarg =3D 0x0, pchararg =3D 0x0,=20
pschararg =3D 0x0, pshortarg =3D 0x0,
     pintarg =3D 0x0, plongarg =3D 0x0, plonglongarg=20
=3D 0x0, pptrdiffarg =3D 0x0, psizearg =3D 0x0, pintmaxarg =3D 0x0,=
 doublearg =3D 0,
     longdoublearg =3D <invalid float value>,=20
wintarg =3D 0, pwchararg =3D 0x0}, {intarg =3D 31662,=20
uintarg =3D 31662, longarg =3D 31662,
     ulongarg =3D 31662, longlongarg =3D 31662,=20
ulonglongarg =3D 31662, ptrdiffarg =3D 31662, sizearg =3D 31662, intmaxarg =
=3D 31662,
     uintmaxarg =3D 31662, pvoidarg =3D 0x7bae,=20
pchararg =3D 0x7bae <Error reading address 0x7bae: Bad address>,
     pschararg =3D 0x7bae <Error reading address=20
0x7bae: Bad address>, pshortarg =3D 0x7bae, pintarg =3D 0x7bae, plongarg =3D=
 0x7bae,
     plonglongarg =3D 0x7bae, pptrdiffarg =3D 0x7bae,=20
psizearg =3D 0x7bae, pintmaxarg =3D 0x7bae, doublearg =3D=
 1.5643106478625548e-319,
     longdoublearg =3D <invalid float value>,=20
wintarg =3D 31662, pwchararg =3D 0x7bae}, {intarg =3D 0, uintarg =3D 0,=
 longarg =3D 0,
     ulongarg =3D 0, longlongarg =3D=20
5244055244786106368, ulonglongarg =3D=20
5244055244786106368, ptrdiffarg =3D 0, sizearg =3D 0,
     intmaxarg =3D 5244055244786106368, uintmaxarg=20
=3D 5244055244786106368, pvoidarg =3D 0x0, pchararg =3D 0x0, pschararg =3D=
 0x0,
     pshortarg =3D 0x0, pintarg =3D 0x0, plongarg =3D=20
0x0, plonglongarg =3D 0x0, pptrdiffarg =3D 0x0, psizearg =3D 0x0, pintmaxarg=
 =3D 0x0,
     doublearg =3D 3.9421446362191564e+42,=20
longdoublearg =3D <invalid float value>, wintarg =3D=20
0, pwchararg =3D 0x0}, {intarg =3D 0,
     uintarg =3D 0, longarg =3D 0, ulongarg =3D 0,=20
longlongarg =3D 0, ulonglongarg =3D 0, ptrdiffarg =3D 0, sizearg =3D 0,=
 intmaxarg =3D 0,
     uintmaxarg =3D 0, pvoidarg =3D 0x0, pchararg =3D=20
0x0, pschararg =3D 0x0, pshortarg =3D 0x0, pintarg =3D 0x0, plongarg =3D=
 0x0,
     plonglongarg =3D 0x0, pptrdiffarg =3D 0x0,=20
psizearg =3D 0x0, pintmaxarg =3D 0x0, doublearg =3D 0,=20
longdoublearg =3D <invalid float value>,
     wintarg =3D 0, pwchararg =3D 0x0}}
         nextarg =3D 10
         orgap =3D 0xbfbfeb74 "A\001"
         convbuf =3D 0x0
         blanks =3D ' ' <repeats 16 times>
         zeroes =3D '0' <repeats 16 times>
         xdigs_lower =3D "0123456789abcdef"
---Type <return> to continue, or q <return> to quit---
         xdigs_upper =3D "0123456789ABCDEF"
         initial =3D {__mbstate8 =3D '\0' <repeats 127 times>, _mbstateL =3D=
 0}
#2  0x281c37e2 in vfprintf (fp=3D0x281e8798,=20
fmt0=3D0x80671ac "%5d %6s %7s %9ju %9ju %9ju %5d=20
%5d %s\n", ap=3D0xbfbfeb74 "A\001")
     at /usr/src/lib/libc/stdio/vfprintf.c:398
         ret =3D 0
#3  0x281ac086 in printf (fmt=3D0x80671ac "%5d %6s=20
%7s %9ju %9ju %9ju %5d %5d %s\n") at /usr/src/lib/libc/stdio/printf.c:49
         ret =3D 76
         ap =3D 0xbfbfeb74 "A\001"
#4  0x08059dc4 in bpf_stats (ifname=3D0x0) at=
 /usr/src/usr.bin/netstat/bpf.c:123
         d =3D (struct xbpf_d *) 0x8101060
         bd =3D (struct xbpf_d *) 0x8101060
         pname =3D 0x8103030 "dhclient"
         flagbuf =3D "-ifs--l\000=FF=FF=FF=FF"
         size =3D 72
#5  0x080504a1 in main (argc=3D0, argv=3D0xbfbfec7c)=20
at /usr/src/usr.bin/netstat/main.c:498
         tp =3D (struct protox *) 0x0
         ch =3D -1
(gdb) frame 0
#0  strlen () at /usr/src/lib/libc/i386/string/strlen.S:48
48              repne                           /* search! */
(gdb) list
43              pushl   %edi
44              movl    8(%esp),%edi            /* string address */
45              cld                             /* set search forward */
46              xorl    %eax,%eax=20
/* set search for null terminator */
47              movl    $-1,%ecx=20
/* set search for lots of characters */
48              repne                           /* search! */
49              scasb
50              notl    %ecx=20
/* get length by taking complement */
51              leal    -1(%ecx),%eax           /* and subtracting one */
52              popl    %edi
(gdb) frame 1
#1  0x281c5491 in __vfprintf (fp=3D0x281e8798,=20
fmt0=3D0x80671ac "%5d %6s %7s %9ju %9ju %9ju %5d %5d %s\n",
     ap=3D0xbfbfeba4 "\224\020\020\bA\001") at=20
/usr/src/lib/libc/stdio/vfprintf.c:1052
1052                                    size =3D strlen(cp);
Current language:  auto; currently c
(gdb) list
1047                                            if (size > prec)
1048                                                    size =3D prec;
1049                                    } else
1050                                            size =3D prec;
1051                            } else
1052                                    size =3D strlen(cp);
1053                            sign =3D '\0';
1054                            break;
1055                    case 'U':
1056                            flags |=3D LONGINT;
(gdb) frame 2
#2  0x281c37e2 in vfprintf (fp=3D0x281e8798,=20
fmt0=3D0x80671ac "%5d %6s %7s %9ju %9ju %9ju %5d=20
%5d %s\n", ap=3D0xbfbfeb74 "A\001")
     at /usr/src/lib/libc/stdio/vfprintf.c:398
398             ret =3D __vfprintf(fp, fmt0, ap);
(gdb) list
393
394     {
395             int ret;
396
397             FLOCKFILE(fp);
398             ret =3D __vfprintf(fp, fmt0, ap);
399             FUNLOCKFILE(fp);
400             return (ret);
401     }
402
(gdb) frame 3
#3  0x281ac086 in printf (fmt=3D0x80671ac "%5d %6s=20
%7s %9ju %9ju %9ju %5d %5d %s\n") at /usr/src/lib/libc/stdio/printf.c:49
49              ret =3D vfprintf(stdout, fmt, ap);
(gdb) list
44      {
45              int ret;
46              va_list ap;
47
48              va_start(ap, fmt);
49              ret =3D vfprintf(stdout, fmt, ap);
50              va_end(ap);
51              return (ret);
52      }
(gdb) frame 4
#4  0x08059dc4 in bpf_stats (ifname=3D0x0) at=
 /usr/src/usr.bin/netstat/bpf.c:123
123                     (void) printf("%5d %6s=20
%7s %9ju %9ju %9ju %5d %5d %s\n",
(gdb) list
118             for (d =3D &bd[0]; d < &bd[size / sizeof(*d)]; d++) {
119                     if (ifname && strcmp(ifname, d->bd_ifname) !=3D 0)
120                             continue;
121                     bpf_flags(d, flagbuf);
122                     pname =3D bpf_pidname(d->bd_pid);
123                     (void) printf("%5d %6s=20
%7s %9ju %9ju %9ju %5d %5d %s\n",
124                         d->bd_pid, d->bd_ifname, flagbuf,
125                         d->bd_rcount, d->bd_dcount, d->bd_fcount,
126                         d->bd_slen, d->bd_hlen, pname);
127                     free(pname);
(gdb) p *d
$1 =3D {bd_promisc =3D 0 '\0', bd_immediate =3D 1=20
'\001', bd_hdrcmplt =3D 0, bd_direction =3D 1, bd_feedback =3D 0, bd_async =
=3D 0,
   bd_rcount =3D 109321, bd_dcount =3D 0, bd_fcount =3D=20
24, bd_sig =3D 23, bd_slen =3D 0, bd_hlen =3D 0, bd_bufsize =3D 4096, bd_pid=
 =3D 321,
   bd_ifname =3D "nfe0", '\0' <repeats 11 times>, bd_locked =3D 1}
(gdb) p pname
$2 =3D 0x8103030 "dhclient"
(gdb) p flagbuf
$3 =3D "-ifs--l\000=FF=FF=FF=FF"
(gdb) frame 5
#5  0x080504a1 in main (argc=3D0, argv=3D0xbfbfec7c)=20
at /usr/src/usr.bin/netstat/main.c:498
498                     bpf_stats(interface);
(gdb) list
493                     setgid(getgid());
494
495             if (Bflag) {
496                     if (!live)
497                             usage();
498                     bpf_stats(interface);
499                     exit(0);
500             }
501             if (mflag) {
502                     if (memf !=3D NULL) {
(gdb)


At 11:05 AM 9/1/2008, David E. O'Brien wrote:
>obrien      2008-09-01 15:05:19 UTC
>
>   FreeBSD src repository
>
>   Modified files:        (Branch: RELENG_7)
>     usr.bin/netstat      Makefile bpf.c inet.c pfkey.c route.c
>                          sctp.c
>   Log:
>   SVN rev 182603 on 2008-09-01 15:05:19Z by obrien
>
>   MFC: r182602: Minimize changes CURRENT<->releng7.
>
>   Revision  Changes    Path
>   1.39.2.1  +1 -0      src/usr.bin/netstat/Makefile
>   1.9.2.2   +2 -2      src/usr.bin/netstat/bpf.c
>   1.78.2.4  +2 -2      src/usr.bin/netstat/inet.c
>   1.5.2.2   +6 -3      src/usr.bin/netstat/pfkey.c
>   1.82.2.7  +8 -7      src/usr.bin/netstat/route.c
>   1.7.2.3   +4 -4      src/usr.bin/netstat/sctp.c
>_______________________________________________
>cvs-all@freebsd.org mailing list
>http://lists.freebsd.org/mailman/listinfo/cvs-all
>To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200809100231.m8A2VliB098720>