Subject: kern/10840: ktruss seems to have odd buffering problems
To: None <gnats-bugs@gnats.netbsd.org>
From: John Hawkinson <jhawk@mit.edu>
List: netbsd-bugs
Date: 08/15/2000 17:29:15
>Number:         10840
>Category:       kern
>Synopsis:       ktruss seems to have odd buffering problems
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 15 17:30:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     John Hawkinson
>Release:        -current of 13 August
>Organization:
MIT
>Environment:
	
System: NetBSD zorkmid.mit.edu 1.5E NetBSD 1.5E (ZORKMID-$Revision: 1.2 $) #38: Sun Aug 13 21:40:17 EDT 2000 jhawk@zorkmid.mit.edu:/usr/local/netbsd-current/src/sys/arch/i386/compile/ZORKMID i386


>Description:
	ktruss and ktrace seem to give different answers for the same thing,
with ktruss giving an answer that is clearly in correct (output
stops in the middle of a system call).
>How-To-Repeat:
	Enable spray in inetd.conf with rpcbind and portmapper disabled.
zorkmid# ktruss spray 10.0.0.1
                                                   = 0
  2248 ktruss   emul(netbsd)
  2248 ktruss   execve("/sbin/spray", 0xbfbfd78c, 0xbfbfd798) Err#2 ENOENT
  2248 ktruss   "/usr/libexec/ld.elf_so"           JUSTRETURN
  2248 spray    emul(netbsd)
  2248 spray    __sysctl(0xbfbfd594, 0x2, 0x4805d0a0, 0xbfbfd590, 0, 0) = 0
  2248 spray    mmap(0, 0x8000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 1208344576
  2248 spray    geteuid                            = 0
  2248 spray    getuid                             = 0
  2248 spray    getegid                            = 0
  2248 spray    getgid                             = 0
  2248 spray    open("/etc/ld.so.conf", 0, 0x4805c414) = 3
  2248 spray    __fstat13(0x3, 0xbfbfd6c8)         = 0
  2248 spray    mmap(0, 0x37, 0x3, 0x2, 0x3, 0, 0, 0) = 1208377344
  2248 spray    close(0x3)                         = 0
  2248 spray    munmap(0x48066000, 0x37)           = 0
  2248 spray    __stat13("/usr/lib/libc.so.12", 0xbfbfd628) = 0
  2248 spray    open("/usr/lib/libc.so.12", 0, 0x4805c414) = 3
  2248 spray    read(0x3, 0xbfbfd5f4, 0x34)        = 52
       "\^?ELF\^A\^A\^A\0\0\0\0\0\0\0\0\0\^C\0\^C\0\^A\0\0\0\M^@V\^A\0004\0\0\0\M^@\M^H\b\0\0\0\0\0004\0 \0\^D\0(\0=\0:\0"
  2248 spray    close(0x3)                         = 0
  2248 spray    open("/usr/lib/libc.so.12", 0, 0x4805c414) = 3
  2248 spray    __fstat13(0x3, 0xbfbfd664)         = 0
  2248 spray    read(0x3, 0xbfbfc640, 0x1000)      = 4096
  2248 spray    mmap(0, 0x8b000, 0x5, 0x2, 0x3, 0, 0, 0) = 1208377344
  2248 spray    mmap(0x480e2000, 0x4000, 0x3, 0x12, 0x3, 0, 0x7b000, 0) = 1208885248
  2248 spray    mmap(0x480e6000, 0xb000, 0x3, 0x1012, 0xffffffff, 0, 0, 0) = 1208901632
  2248 spray    close(0x3)                         = 0
  2248 spray    __sysctl(0xbfbfd634, 0x2, 0xbfbfd62c, 0xbfbfd630, 0, 0) = 0
  2248 spray    "/etc/malloc.conf"                 Err#2 ENOENT
  2248 spray    mmap(0, 0x1000, 0x3, 0x1002, 0xffffffff, 0, 0, 0) = 1208946688
  2248 spray    break(0x804c5f0)                   = 0
  2248 spray    break(0x804c5f0)                   = 0
  2248 spray    break(0x804e000)                   = 0
  2248 spray    break(0x804e000)                   = 0
  2248 spray    break(0x804f000)                   = 0
  2248 spray    open("/etc/netconfig", 0, 0x1b6)   = 3
  2248 spray    break(0x804f000)                   = 0
  2248 spray    break(0x8050000)                   = 0
  2248 spray    __fstat13(0x3, 0xbfbfd5d0)         = 0
  2248 spray    break(0x8050000)                   = 0
  2248 spray    break(0x8052000)                   = 0
  2248 spray    read(0x3, 0x8050000, 0x2000)       = 774
       "# $NetBSD: netconfig,v 1.1 2000/06/02 22:54:10 fvdl Exp $\n#\n# The network configuration file. This file is currently only us"
  2248 spray    break(0x8052000)                   = 0
  2248 spray    break(0x8053000)                   = 0
  2248 spray    open("/etc/services", 0, 0x1b6)    = 4
  2248 spray    __fstat13(0x4, 0xbfbfd3bc)         = 0
  2248 spray    break(0x8053000)                   = 0
  2248 spray    break(0x8055000)                   = 0
  2248 spray    read(0x4, 0x8053000, 0x2000)       = 7861
  2248 spray    close(0x4)                         = 0
  2248 spray    open("/etc/services", 0, 0x1b6)    = 4
  2248 spray    __fstat13(0x4, 0xbfbfd38c)         = 0
  2248 spray    read(0x4, 0x8053000, 0x2000)       = 7861
  2248 spray    close(0x4)                         = 0
  2248 spray    open("/etc/services", 0, 0x1b6)    = 4
  2248 spray    __fstat13(0x4, 0xbfbfd334)         = 0
  2248 spray    read(0x4, 0x8053000, 0x2000)       = 7861
  2248 spray    close(0x4)                         = 0
  2248 spray    open("/etc/services", 0, 0x1b6)    = 4
  2248 spray    __fstat13(0x4, 0xbfbfd394)         = 0
  2248 spray    read(0x4, 0x8053000, 0x2000)       = 7861
  2248 spray    close(0x4)                         = 0
  2248 spray    __stat13("/etc/nsswitch.conf", 0xbfbfd414) = 0
  2248 spray    open(
sending 1162 packets of lnth 86 to 10.0.0.1 ...spray: RPC: Unable to send; errno = No buffer space available



zorkmid# ktrace spray 10.0.0.1
zorkmid# kdump
  2250 ktrace   EMUL  "netbsd"
  2250 ktrace   RET   ktrace 0
  2250 ktrace   CALL  execve(0xbfbfd300,0xbfbfd78c,0xbfbfd798)
  2250 ktrace   NAMI  "/sbin/spray"
  2250 ktrace   RET   execve -1 errno 2 No such file or directory
  2250 ktrace   CALL  execve(0xbfbfd300,0xbfbfd78c,0xbfbfd798)
  2250 ktrace   NAMI  "/usr/sbin/spray"
  2250 ktrace   NAMI  "/usr/libexec/ld.elf_so"
  2250 spray    EMUL  "netbsd"
  2250 spray    RET   execve JUSTRETURN
  2250 spray    CALL  __sysctl(0xbfbfd594,0x2,0x4805d0a0,0xbfbfd590,0,0)
  2250 spray    RET   __sysctl 0
...
  2250 spray    CALL  __stat13(0x480dfb3e,0xbfbfd414)
  2250 spray    NAMI  "/etc/nsswitch.conf"
  2250 spray    RET   __stat13 0
  2250 spray    CALL  open(0x480dfb3e,0,0x1b6)
  2250 spray    NAMI  "/etc/nsswitch.conf"
  2250 spray    RET   open 4
...
  2250 spray    CALL  sendto(0x4,0x805a0d8,0x28,0,0x8058008,0x10)
  2250 spray    RET   sendto -1 errno 55 No buffer space available
  2250 spray    CALL  open(0xbfbfd28c,0,0x480e46fc)
  2250 spray    NAMI  "/usr/share/nls/C/libc.cat"
  2250 spray    RET   open 3
  2250 spray    CALL  __fstat13(0x3,0xbfbfd20c)
  2250 spray    RET   __fstat13 0
  2250 spray    CALL  mmap(0,0xf57,0x1,0x1,0x3,0,0,0)
  2250 spray    RET   mmap 1208950784/0x480f2000
  2250 spray    CALL  close(0x3)
  2250 spray    RET   close 0
  2250 spray    CALL  munmap(0x480f2000,0xf57)
  2250 spray    RET   munmap 0
  2250 spray    CALL  write(0x2,0xbfbfd038,0x3e)
  2250 spray    GIO   fd 2 wrote 62 bytes
       "spray: RPC: Unable to send; errno = No buffer space available
       "
  2250 spray    RET   write 62/0x3e
  2250 spray    CALL  exit(0x1)

>Fix:
	
	Don't use ktruss?
>Release-Note:
>Audit-Trail:
>Unformatted: