Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Nov 2003 01:44:38 -0200 (BRST)
From:      Joao Carlos Mendes Luis <jonny@jonny.eng.br>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        rsync@lists.samba.org
Subject:   kern/59814: FreeBSD mknod refuses to create pipes and fifos
Message-ID:  <20031130034438.B1D8612B58C@faperj.br>
Resent-Message-ID: <200311300350.hAU3oI5J070998@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         59814
>Category:       kern
>Synopsis:       FreeBSD mknod refuses to create pipes and fifos
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Nov 29 19:50:17 PST 2003
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031130034438.B1D8612B58C>