From citylink.dinoex.sub.org!admin@net2.dinoex.sub.org  Tue Jun 10 17:07:20 1997
Received: from mail.Contrib.Com (mail.Contrib.Com [194.77.12.8])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id RAA14540
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 10 Jun 1997 17:07:16 -0700 (PDT)
Received: from net2.dinoex.sub.org (net2.dinoex.sub.de [193.203.172.193])
          by mail.Contrib.Com (8.8.4/8.8.4) with SMTP
	  id CAA24735 for <freebsd.org!FreeBSD-gnats-submit>; Wed, 11 Jun 1997 02:07:05 +0200 (MET DST)
Received: from citylink.dinoex.sub.org by net2.dinoex.sub.org with UUCP
	(Smail3.1.29.1 #1) id m0wbVYW-000EEcC; Tue, 10 Jun 97 20:22 CEST
Received: (from admin@localhost) by citylink.dinoex.sub.org (8.8.5/PMuch-B3b)
	id RAA21872; Tue, 10 Jun 1997 17:52:31 +0200 (CEST)
Message-Id: <199706101552.RAA21872@citylink.dinoex.sub.org>
Date: Tue, 10 Jun 1997 17:52:31 +0200 (CEST)
From: admin@citylink.dinoex.sub.org (Maschinenwart)
Reply-To: admin@citylink.dinoex.sub.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: fifos on nfs-mounted fs no longer permitted
X-Send-Pr-Version: 3.2

>Number:         3838
>Category:       kern
>Synopsis:       fifos on nfs-mounted fs no longer permitted
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 10 17:10:04 PDT 1997
>Closed-Date:    Mon Jun 16 04:24:43 PDT 1997
>Last-Modified:  Mon Jun 16 04:26:45 PDT 1997
>Originator:     Peter Much
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
Beyond the Future Shockwave: Convenience or Conviviality?
>Environment:

>Description:

mkfifo on a nfs-mounted filesystem will reply: "operation not permitted".
This didn't happen with release 2.1.0. (No, the fs isn't mounted with
nodev!)

>How-To-Repeat:

>Fix:

Regards,
PM
>Release-Note:
>Audit-Trail:

From: Bruce Evans <bde@zeta.org.au>
To: admin@citylink.dinoex.sub.org, FreeBSD-gnats-submit@freebsd.org
Cc: dfr@freebsd.org
Subject: Re: kern/3838: fifos on nfs-mounted fs no longer permitted
Date: Wed, 11 Jun 1997 12:54:13 +1000

 >mkfifo on a nfs-mounted filesystem will reply: "operation not permitted".
 >This didn't happen with release 2.1.0. (No, the fs isn't mounted with
 >nodev!)
 
 This was broken in the initial v3 import (rev.1.16), which is essentially
 the same as Lite2.  There are several bugs:
 
 1. In the v2 case, nfsrv_create() lost some special handling for fifos.
    suser() is always called, although mkfifo doesn't require special
    privileges.
 2. In the v3 case, the new nfsrv_mknod() never had enough special handling
    for fifos.  suser() is always called, except for sockets.
 3. In the v3 case, after suser() fails, the error code is eventually
    thrown away.  nfsrv_mknod() returns 0, and mkfifo() returns the bogus
    errno EIO.
 
 Bruce
 
 Untested fixes for (1)-(2):
 
 diff -c2 nfs_serv.c~ nfs_serv.c
 *** nfs_serv.c~	Wed Jun  4 11:38:41 1997
 --- nfs_serv.c	Wed Jun 11 12:43:03 1997
 ***************
 *** 1428,1432 ****
   			if (vap->va_type == VCHR && rdev == 0xffffffff)
   				vap->va_type = VFIFO;
 ! 			if (error = suser(cred, (u_short *)0)) {
   				vrele(nd.ni_startdir);
   				free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
 --- 1427,1432 ----
   			if (vap->va_type == VCHR && rdev == 0xffffffff)
   				vap->va_type = VFIFO;
 ! 			if (vap->va_type == VFIFO &&
 ! 			    (error = suser(cred, (u_short *)0))) {
   				vrele(nd.ni_startdir);
   				free(nd.ni_cnd.cn_pnbuf, M_NAMEI);
 ***************
 *** 1622,1626 ****
   			FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
   	} else {
 ! 		if (error = suser(cred, (u_short *)0)) {
   			vrele(nd.ni_startdir);
   			free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);
 --- 1624,1628 ----
   			FREE(nd.ni_cnd.cn_pnbuf, M_NAMEI);
   	} else {
 ! 		if (vtyp != VFIFO && (error = suser(cred, (u_short *)0))) {
   			vrele(nd.ni_startdir);
   			free((caddr_t)nd.ni_cnd.cn_pnbuf, M_NAMEI);

From: Doug Rabson <dfr@nlsystems.com>
To: Bruce Evans <bde@zeta.org.au>
Cc: admin@citylink.dinoex.sub.org, FreeBSD-gnats-submit@freebsd.org,
        dfr@freebsd.org
Subject: Re: kern/3838: fifos on nfs-mounted fs no longer permitted
Date: Sun, 15 Jun 1997 11:57:50 +0100 (BST)

 On Wed, 11 Jun 1997, Bruce Evans wrote:
 
 > >mkfifo on a nfs-mounted filesystem will reply: "operation not permitted".
 > >This didn't happen with release 2.1.0. (No, the fs isn't mounted with
 > >nodev!)
 > 
 > This was broken in the initial v3 import (rev.1.16), which is essentially
 > the same as Lite2.  There are several bugs:
 > 
 > 1. In the v2 case, nfsrv_create() lost some special handling for fifos.
 >    suser() is always called, although mkfifo doesn't require special
 >    privileges.
 > 2. In the v3 case, the new nfsrv_mknod() never had enough special handling
 >    for fifos.  suser() is always called, except for sockets.
 > 3. In the v3 case, after suser() fails, the error code is eventually
 >    thrown away.  nfsrv_mknod() returns 0, and mkfifo() returns the bogus
 >    errno EIO.
 > 
 > Bruce
 > 
 > Untested fixes for (1)-(2):
 > 
 > ! 			if (vap->va_type == VFIFO &&
 > ! 			    (error = suser(cred, (u_short *)0))) {
 
 I think this should be:
 
 			if (vap->va_type != VFIFO &&
 			    (error = suser(cred, (u_short *)0))) {
 
 Apart from that, your fixes seem to work fine.
 
 Oh.  I just noticed that your fixes have already been committed.  Sorry
 for not giving feedback earlier; I have been extremely busy on other stuff
 for the last few days.
 
 --
 Doug Rabson				Mail:  dfr@nlsystems.com
 Nonlinear Systems Ltd.			Phone: +44 181 951 1891
 					Fax:   +44 181 381 1039
 
State-Changed-From-To: open->closed 
State-Changed-By: bde 
State-Changed-When: Mon Jun 16 04:24:43 PDT 1997 
State-Changed-Why:  

Fixed in rev.1.44 (-current) and 1.34.2.2 (-2.2) of nfs_serv.c. 
>Unformatted:
