cvs commit: src/usr.bin/netstat Makefile bpf.c inet.c pfkey.c route.c sctp.c

Mike Tancsa mike at sentex.net
Wed Sep 10 02:31:52 UTC 2008


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



More information about the freebsd-stable mailing list