Bug 59814 - FreeBSD mknod refuses to create pipes and fifos
FreeBSD mknod refuses to create pipes and fifos
Status: Closed FIXED
Product: Base System
Classification: Unclassified
Component: kern
Any Any
: Normal Affects Only Me
Assigned To: Remko Lodder
Depends on:
  Show dependency treegraph
Reported: 2003-11-30 03:50 UTC by jonny
Modified: 2007-04-12 21:13 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description jonny 2003-11-30 03:50:17 UTC
	mknod(2) does not create fifos and sockets, as expected from rsync

	Probably this is supported in some other operating system

Fix: Suggested patches to kernel:

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...--KU544RSpj6s6AORFXgxvodKQQIKUPesQyxu8AfrS14fUPuCx
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- 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);
+	case S_IFIFO:
+	case S_IFSOCK:
+		error = 0;
+		break;
 		error = suser_xxx(0, p, PRISON_ROOT);
@@ -1217,6 +1221,12 @@
 		case S_IFBLK:
 			vattr.va_type = VBLK;
+			break;
+		case S_IFSOCK:
+			vattr.va_type = VSOCK;
+			break;
+		case S_IFIFO:
+			vattr.va_type = VFIFO;
 		case S_IFWHT:
 			whiteout = 1;
	Copy a fifo and a socket with rsync

	mkfifo /tmp/fifo
	rsync -avP /var/run/log /tmp/fifo /tmp/output/
Comment 1 Remko Lodder freebsd_committer 2006-12-29 19:15:02 UTC
State Changed
From-To: open->closed

mknod is deprecated, nowadays we use devfs to create the required 
devices and settings.
Comment 2 Remko Lodder freebsd_committer 2006-12-29 19:18:26 UTC
State Changed
From-To: closed->feedback

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 ? 

Comment 3 Remko Lodder freebsd_committer 2006-12-29 19:18:26 UTC
Responsible Changed
From-To: freebsd-bugs->remko

grab the pr for feedback
Comment 4 gavin.atkinson 2007-04-12 20:06:39 UTC
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
Comment 5 Remko Lodder freebsd_committer 2007-04-12 21:13:18 UTC
State Changed
From-To: feedback->closed

Duplicate of kern/68459 which is more complete then this ticket. Please 
continue this on the other PR.