NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
bin/48925: netbsd-6 fstat(1) pmisc descriptor number mismatch
>Number: 48925
>Category: bin
>Synopsis: netbsd-6 fstat(1) pmisc descriptor number mismatch
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jun 19 08:25:00 +0000 2014
>Originator: Matthew Mondor
>Release: NetBSD 6.1_STABLE
>Organization:
>Environment:
System: NetBSD ninja.xisop 6.1_STABLE NetBSD 6.1_STABLE (GENERIC_MM) #3: Mon
Jul 1 19:08:46 EDT 2013
root@ninja.xisop:/usr/obj/sys/arch/amd64/compile/GENERIC_MM amd64
Architecture: x86_64
Machine: amd64
>Description:
As can be seen below, some file descriptor types (handled by pmisc())
are reported with a wrong FD number.
# fstat -p 14403
USER CMD PID FD MOUNT INUM MODE SZ|DV R/W
mmondor tms-server 14403 wd / 2 drwxr-xr-x 1024 r
mmondor tms-server 14403 0 / 873100 crw-rw-rw- null rw
mmondor tms-server 14403 1 / 873100 crw-rw-rw- null rw
mmondor tms-server 14403 2 / 873100 crw-rw-rw- null rw
mmondor tms-server 14403 3* unix dgram <-> fffffe810ede6f08
mmondor tms-server 14403 4* kqueue pending 0
mmondor tms-server 14403 5* internet stream tcp *:7777
mmondor tms-server 14403 5* misc 0xfffffe810f768fa8
mmondor tms-server 14403 7* internet stream tcp 192.168.1.15:64000 <->
192.168.1.15:7777
[...]
www httpd 314 5* crypto 0xc378cdd4
www httpd 314 5* crypto 0xc378cd6c
www httpd 314 5* crypto 0xc378cd04
www httpd 314 5* crypto 0xc378cc9c
www httpd 314 5* crypto 0xc378cc34
www httpd 314 5* crypto 0xc378cbcc
www httpd 314 5* crypto 0xc378cb64
www httpd 314 5* crypto 0xc378cafc
www httpd 314 5* crypto 0xc378ca94
www httpd 314 61* pipe 0xc4372d88 <- 0xc3aba304 rn
www httpd 314 62* pipe 0xc3aba304 -> 0xc4372d88 w
www httpd 314 63 / 349490 -rw-r----- 784855 w
www httpd 314 4* kqueue pending 1
www httpd 314 65* pipe 0xc4377cc8 -> 0xc4372848 w
www httpd 314 67* unix stream <-> c86d4504
www httpd 314 68* unix stream <-> c7b9b1e4
>How-To-Repeat:
Use fstat on processes using kqueue, crypto, misc, etc
>Fix:
The attached diff appears to fix it for me.
--MP_/xAK7ceaI/SWkG6Lq6fW8H_1
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=netbsd-6-fstat.diff
Index: usr.bin/fstat/fstat.c
===================================================================
RCS file: /data/rsync/netbsd-cvs/src/usr.bin/fstat/fstat.c,v
retrieving revision 1.95.4.1
diff -u -p -r1.95.4.1 fstat.c
--- usr.bin/fstat/fstat.c 2 Apr 2012 18:22:03 -0000 1.95.4.1
+++ usr.bin/fstat/fstat.c 19 Jun 2014 08:03:04 -0000
@@ -170,7 +170,7 @@ static const char *inet6_addrstr(char *,
#endif
static const char *at_addrstr(char *, size_t, const struct sockaddr_at *);
static void socktrans(struct socket *, int);
-static void misctrans(struct file *);
+static void misctrans(int fd, struct file *);
static int ufs_filestat(struct vnode *, struct filestat *);
static void usage(void) __dead;
static const char *vfilestat(struct vnode *, struct filestat *);
@@ -424,7 +424,7 @@ ftrans(fdfile_t *fp, int i)
case DTYPE_MQUEUE:
case DTYPE_SEM:
if (checkfile == 0)
- misctrans(&file);
+ misctrans(i, &file);
break;
default:
dprintf("unknown file type %d for file %d of pid %d",
@@ -1081,10 +1081,10 @@ bad:
}
static void
-misctrans(struct file *file)
+misctrans(int fd, struct file *file)
{
- PREFIX((int)file->f_type);
+ PREFIX(fd);
pmisc(file, dtypes[file->f_type]);
}
--MP_/xAK7ceaI/SWkG6Lq6fW8H_1--
>Unformatted:
--MP_/xAK7ceaI/SWkG6Lq6fW8H_1
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Home |
Main Index |
Thread Index |
Old Index