Joao Carlos Mendes Luis
2003-Nov-30 14:44 UTC
FreeBSD mknod refuses to create pipes and fifos
>Submitter-Id: current-users >Originator: Joao Carlos Mendes Luis >Organization: >Confidential: no >Synopsis: FreeBSD mknod refuses to create pipes and fifos >Severity: non-critical >Priority: low >Category: kern >Class: change-request >Release: FreeBSD 4.9-RC i386 >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...
Seemingly Similar Threads
- FreeBSD-SA-99:01: BSD File Flags and Programming Techniques
- 9.2-RC1 panic at shutdown
- Code/comment mismatch in delegated administration code.
- [PATCH] mknod: filter modes in mkfifo, mknod_b, mknod_c (RHBZ#1182463).
- DO NOT REPLY [Bug 6280] New: (Bug incl. PATCH) Linux mknod does not work when syncing fifos and sockets from Solaris