From root@faperj.br  Sat Nov 29 19:44:44 2003
Return-Path: <root@faperj.br>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7BDCD16A4CE
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 29 Nov 2003 19:44:44 -0800 (PST)
Received: from mailhost.faperj.br (caronte.faperj.br [200.6.41.100])
	by mx1.FreeBSD.org (Postfix) with ESMTP id E3E0643F3F
	for <FreeBSD-gnats-submit@freebsd.org>; Sat, 29 Nov 2003 19:44:42 -0800 (PST)
	(envelope-from root@faperj.br)
Received: from faperj.br (zeus.faperj.br [10.0.0.2])
	by mailhost.faperj.br (Postfix) with ESMTP
	id B996225570A; Sun, 30 Nov 2003 01:44:38 -0200 (BRST)
Received: by faperj.br (Postfix, from userid 0)
	id B1D8612B58C; Sun, 30 Nov 2003 01:44:38 -0200 (BRST)
Message-Id: <20031130034438.B1D8612B58C@faperj.br>
Date: Sun, 30 Nov 2003 01:44:38 -0200 (BRST)
From: Joao Carlos Mendes Luis <jonny@jonny.eng.br>
Reply-To: Joao Carlos Mendes Luis <jonny@jonny.eng.br>
To: FreeBSD-gnats-submit@freebsd.org
Cc: rsync@lists.samba.org
Subject: FreeBSD mknod refuses to create pipes and fifos
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         59814
>Category:       kern
>Synopsis:       FreeBSD mknod refuses to create pipes and fifos
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    remko
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 29 19:50:17 PST 2003
>Closed-Date:    Thu Apr 12 20:13:20 GMT 2007
>Last-Modified:  Thu Apr 12 20:13:20 GMT 2007
>Originator:     Joao Carlos Mendes Luis
>Release:        FreeBSD 4.9-RC i386
>Organization:
>Environment:
System: FreeBSD zeus.faperj.br 4.9-RC FreeBSD 4.9-RC #3: Sat Oct 25 17:54:52 BRST 2003 Jonny@zeus.faperj.br:/usr/cvsup/RELENG_4/src/sys/compile/ZEUS i386


>Description:

	mknod(2) does not create fifos and sockets, as expected from rsync

	Probably this is supported in some other operating system

>How-To-Repeat:

	Copy a fifo and a socket with rsync

	Example:
	mkfifo /tmp/fifo
	rsync -avP /var/run/log /tmp/fifo /tmp/output/

>Fix:

Suggested patches to kernel:

--- sys/kern/vfs_syscalls.c.orig	Sun Nov 30 00:59:29 2003
+++ sys/kern/vfs_syscalls.c	Sun Nov 30 01:25:35 2003
@@ -1189,6 +1189,10 @@
 	case S_IFBLK:
 		error = suser(p);
 		break;
+	case S_IFIFO:
+	case S_IFSOCK:
+		error = 0;
+		break;
 	default:
 		error = suser_xxx(0, p, PRISON_ROOT);
 		break;
@@ -1217,6 +1221,12 @@
 			break;
 		case S_IFBLK:
 			vattr.va_type = VBLK;
+			break;
+		case S_IFSOCK:
+			vattr.va_type = VSOCK;
+			break;
+		case S_IFIFO:
+			vattr.va_type = VFIFO;
 			break;
 		case S_IFWHT:
 			whiteout = 1;


1) I'm not sure if FIFO and/or SOCK creation with mknod should be allowed to
non-root users.  This patch allows non-root to create them, but it's easy to
change that.

2) Should we allow IFREG creation with mknod?  I did not find a reason to
disallow that, but since this does not bother me with rsync, I did not
touch that...

3) I did test it with ffs, but did not test with other media, like NFS
or EXT2FS.

Thanks a lot for your attention...

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: remko 
State-Changed-When: Fri Dec 29 19:15:02 UTC 2006 
State-Changed-Why:  
mknod is deprecated, nowadays we use devfs to create the required 
devices and settings. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59814 
State-Changed-From-To: closed->feedback 
State-Changed-By: remko 
State-Changed-When: Fri Dec 29 19:18:26 UTC 2006 
State-Changed-Why:  
OK i got told by Simon that this is not related to devfs 
apparently I confused mknod with MAKEDEV.  So lets do the 
other thing, can you tell me whether this problem is still 
accurate on recent FreeBSD releases like 6.1 and possibly 
even the latest FreeBSD 6.2 RC-2 ? 


Responsible-Changed-From-To: freebsd-bugs->remko 
Responsible-Changed-By: remko 
Responsible-Changed-When: Fri Dec 29 19:18:26 UTC 2006 
Responsible-Changed-Why:  
grab the pr for feedback 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59814 

From: Gavin Atkinson <gavin.atkinson@ury.york.ac.uk>
To: bug-followup@FreeBSD.org, jonny@jonny.eng.br
Cc:  
Subject: Re: kern/59814: FreeBSD mknod refuses to create pipes and fifos
Date: Thu, 12 Apr 2007 20:06:39 +0100

 This PR can probably be closed. PR kern/68459 is a duplicate of this,
 was submitted by the same author, and looks to have a more complete
 patch.
 
State-Changed-From-To: feedback->closed 
State-Changed-By: remko 
State-Changed-When: Thu Apr 12 20:13:18 UTC 2007 
State-Changed-Why:  
Duplicate of kern/68459 which is more complete then this ticket. Please 
continue this on the other PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=59814 
>Unformatted:
