From nobody  Sun May 25 11:27:11 1997
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.5/8.8.5) id LAA02304;
          Sun, 25 May 1997 11:27:11 -0700 (PDT)
Message-Id: <199705251827.LAA02304@hub.freebsd.org>
Date: Sun, 25 May 1997 11:27:11 -0700 (PDT)
From: cschuber@uumail.gov.bc.ca
To: freebsd-gnats-submit@freebsd.org
Subject: panic: fdesc attr
X-Send-Pr-Version: www-1.0

>Number:         3685
>Category:       kern
>Synopsis:       [PATCH] panic: fdesc attr
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun May 25 11:30:01 PDT 1997
>Closed-Date:    Mon Jun 4 18:38:31 PDT 2001
>Last-Modified:  Mon Jun 04 18:38:41 PDT 2001
>Originator:     Cy Schubert
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
ITSD Province of BC
>Environment:
FreeBSD cwsys 2.2.1-RELEASE FreeBSD 2.2.1-RELEASE #0: Sun May 25 10:06:48 PDT 1997     root@cwsys:/opt/usr_src/sys/compile/CWSYS  i386

>Description:
find / -type d -perm 777 | xargs ls -ld causes,
panic: fdesc attr
        
KGDB session follows:

(kgdb) symbol-file /kernel
Reading symbols from /kernel...done.
(kgdb) exec-file /var/crash/kernel.1
(kgdb) core-file /var/crash/vmcore.1
IdlePTD 1f5000
current pcb at 1d9ae0
panic: fdesc attr
#0  boot (howto=256) at ../../kern/kern_shutdown.c:243
243                                     dumppcb.pcb_cr3 = rcr3();
(kgdb) bt
#0  boot (howto=256) at ../../kern/kern_shutdown.c:243
#1  0xf010de52 in panic (fmt=0xf0131756 "fdesc attr")
#1  0xf010de52 in panic (fmt=0xf0131756 "fdesc attr")
    at ../../kern/kern_shutdown.c:367
#2  0xf01318fa in fdesc_attr (fd=1, vap=0xefbffdd0, cred=0xf1347780,
    p=0xf1269400) at ../../miscfs/fdesc/fdesc_vnops.c:436
#3  0xf0131a7e in fdesc_getattr (ap=0xefbffdbc)
    at ../../miscfs/fdesc/fdesc_vnops.c:504
#4  0xf01309bc in vn_stat (vp=0xf139f400, sb=0xefbffef8, p=0xf1269400)
    at vnode_if.h:199
#5  0xf012eada in lstat (p=0xf1269400, uap=0xefbfff94, retval=0xefbfff84)
    at ../../kern/vfs_syscalls.c:1346
#6  0xf01b11d3 in syscall (frame={tf_es = 39, tf_ds = 39, tf_edi = 42752,
      tf_esi = 42820, tf_ebp = -272639204, tf_isp = -272629788,
      tf_ebx = 134713440, tf_edx = 42816, tf_ecx = 32768, tf_eax = 190,
      tf_trapno = 7, tf_err = 7, tf_eip = 134497889, tf_cs = 31,
      tf_eflags = 582, tf_esp = -272639332, tf_ss = 39})
    at ../../i386/i386/trap.c:890
#7  0x8044661 in ?? ()
#8  0x8039c4d in ?? ()
#9  0x80395ca in ?? ()
#10 0x1673 in ?? ()
#11 0x31c2 in ?? ()
      tf_ebx = 134713440, tf_edx = 42816, tf_ecx = 32768, tf_eax = 190,
      tf_trapno = 7, tf_err = 7, tf_eip = 134497889, tf_cs = 31,
      tf_eflags = 582, tf_esp = -272639332, tf_ss = 39})
    at ../../i386/i386/trap.c:890
#7  0x8044661 in ?? ()
#8  0x8039c4d in ?? ()

Looking at the arguments passed to lstat() as saved in stack frame #5,
uap->path points to a null terminated string containing "1", which was
the name of any file found by find.  The filename /tmp/.X11-unix does
have a "1" in it.

>How-To-Repeat:
find / -type d -perm 777 | xargs ls -ld   -- or --
find / -type d -perm 777 | xargs ls -l
>Fix:
No fix is available.

Circumvention is:

find / -type d -perm 777 >/tmp/foobar
xargs ls -ld </tmp/foobar
>Release-Note:
>Audit-Trail:

From: Cy Schubert <cys@wlc.com>
To: freebsd-gnats-submit@freebsd.org, cschuber@uumail.gov.bc.ca,
        cy@uumail.gov.bc.ca
Cc:  Subject: Re: kern/3685: panic: fdesc attr
Date: Fri, 02 Jan 1998 09:41:10 -0800

 I finally had some time to look at this and here is a patch.  The patch
 reports pipes (DTYPE_PIPE) as fifos (VFIFO).  I think that this is
 acceptable because pipes which normally do not show up in a directory
 listing do show up in the fdesc filesystem (semantics of the fdesc
 filesystem are already slightly different from the normal semantics).
 
 --- sys/miscfs/fdesc/fdesc_vnops.c.orig Sat Dec 21 11:04:28 1996
 +++ sys/miscfs/fdesc/fdesc_vnops.c      Fri Jan  2 09:18:12 1998
 @@ -409,11 +409,18 @@
                 }
                 break;
 
 +       case DTYPE_PIPE:
         case DTYPE_SOCKET:
 -               error = soo_stat((struct socket *)fp->f_data, &stb);
 +               if (fp->f_type == DTYPE_SOCKET)
 +                       error = soo_stat((struct socket *)fp->f_data,
 &stb);
 +               else
 +                       error = pipe_stat((struct pipe *)fp->f_data,
 &stb);
                 if (error == 0) {
                         vattr_null(vap);
 -                       vap->va_type = VSOCK;
 +                       if (fp->f_type == DTYPE_SOCKET)
 +                               vap->va_type = VSOCK;
 +                       else
 +                               vap->va_type = VFIFO;
                         vap->va_mode = stb.st_mode;
                         vap->va_nlink = stb.st_nlink;
                         vap->va_uid = stb.st_uid;
 @@ -557,6 +564,7 @@
                 error = VOP_SETATTR((struct vnode *) fp->f_data,
 ap->a_vap, ap->a_cred, ap->a_p);
                 break;
 
 +       case DTYPE_PIPE:
         case DTYPE_SOCKET:
                 error = 0;
                 break;
 
 
 Regards,                       Phone:  (250)387-8437
 Cy Schubert                      Fax:  (250)387-5766
 UNIX Support                   OV/VM:  BCSC02(CSCHUBER)
 ITSD                          BITNET:  CSCHUBER@BCSC02.BITNET
 Government of BC            Internet:  cschuber@uumail.gov.bc.ca
                                        Cy.Schubert@gems8.gov.bc.ca
 
                 "Quit spooling around, JES do it."
 
 
State-Changed-From-To: open->suspended 
State-Changed-By: phk 
State-Changed-When: Wed Apr 29 06:21:52 PDT 1998 
State-Changed-Why:  
somebody test & commit please 

From: Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
To: freebsd-gnats-submit@FreeBSD.org, cschuber@uumail.gov.bc.ca
Cc:  
Subject: Re: kern/3685: [BPATCH%] panic: fdesc attr
Date: Sat, 2 Jun 2001 23:41:25 +0200

 This PR can be closed.
 There have been many changes to this file; instead of a switch(fp->f_type)
 there's now a call fo_stat(fp, ...) etc.
 
 Also, I can't reproduce this panic on -current:
 
 /tmp#mount_fdescfs fdesc /tmp/fdd 
 /tmp#find /tmp -type d -perm 777 | xargs ls -ld 
 find: /tmp/fdd/8: Bad file descriptor
 /tmp#
 /tmp#find /tmp -type d -perm 777 | xargs ls -l 
 find: /tmp/fdd/8: Bad file descriptor
 /tmp#
 /tmp#uname -a
 FreeBSD i609.hadiko.de 5.0-CURRENT FreeBSD 5.0-CURRENT #402: Fri Jun  1 19:10:19 CEST 2001     p@i609.hadiko.de:/usr/obj/usr/src/sys/I609  i386
 
 
 Bye, Philipp

From: Cy Schubert - ITSD Open Systems Group <Cy.Schubert@uumail.gov.bc.ca>
To: Philipp Mergenthaler <philipp.mergenthaler@stud.uni-karlsruhe.de>
Cc: freebsd-gnats-submit@FreeBSD.org, cschuber@uumail.gov.bc.ca
Subject: Re: kern/3685: [BPATCH%] panic: fdesc attr 
Date: Mon, 04 Jun 2001 09:50:43 -0700

 In message <20010602234125.A2255@i609.hadiko.de>, Philipp Mergenthaler 
 writes:
 > This PR can be closed.
 > There have been many changes to this file; instead of a switch(fp->f_type)
 > there's now a call fo_stat(fp, ...) etc.
 > 
 > Also, I can't reproduce this panic on -current:
 > 
 > /tmp#mount_fdescfs fdesc /tmp/fdd 
 > /tmp#find /tmp -type d -perm 777 | xargs ls -ld 
 > find: /tmp/fdd/8: Bad file descriptor
 > /tmp#
 > /tmp#find /tmp -type d -perm 777 | xargs ls -l 
 > find: /tmp/fdd/8: Bad file descriptor
 > /tmp#
 > /tmp#uname -a
 > FreeBSD i609.hadiko.de 5.0-CURRENT FreeBSD 5.0-CURRENT #402: Fri Jun  1 19:10
 > :19 CEST 2001     p@i609.hadiko.de:/usr/obj/usr/src/sys/I609  i386
 > 
 > 
 > Bye, Philipp
 
 Sure, let's close it.  I cannot recreate the problem under -stable 
 either:
 
 FreeBSD passer 4.3-RELEASE FreeBSD 4.3-RELEASE #1: Wed May  9 06:48:58 
 PDT 2001     root@:/opt/cvs-430r/src/sys/compile/PASSER
 
 Regards,                         Phone:  (250)387-8437
 Cy Schubert                        Fax:  (250)387-5766
 Team Leader, Sun/Alpha Team   Internet:  Cy.Schubert@osg.gov.bc.ca
 Open Systems Group, ITSD, ISTA
 Province of BC
 
 
 
State-Changed-From-To: suspended->closed 
State-Changed-By: dd 
State-Changed-When: Mon Jun 4 18:38:31 PDT 2001 
State-Changed-Why:  
Requested by originator. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=3685 
>Unformatted:
