svn commit: r302893 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Fri Jul 15 09:23:20 UTC 2016


Author: kib
Date: Fri Jul 15 09:23:18 2016
New Revision: 302893
URL: https://svnweb.freebsd.org/changeset/base/302893

Log:
  Do not allow creation of char or block special nodes with VNOVAL dev_t.
  
  As was reported on http://seclists.org/oss-sec/2016/q3/68, tmpfs code
  contains assertion that rdev != VNOVAL.  On FreeBSD, there is no other
  consequences except triggering the assert.  To be compatible with
  systems where device nodes have some significance, reject mknod(2)
  call with dev == VNOVAL at the syscall level.
  
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/kern/vfs_syscalls.c

Modified: head/sys/kern/vfs_syscalls.c
==============================================================================
--- head/sys/kern/vfs_syscalls.c	Fri Jul 15 08:40:22 2016	(r302892)
+++ head/sys/kern/vfs_syscalls.c	Fri Jul 15 09:23:18 2016	(r302893)
@@ -1167,6 +1167,8 @@ kern_mknodat(struct thread *td, int fd, 
 	case S_IFCHR:
 	case S_IFBLK:
 		error = priv_check(td, PRIV_VFS_MKNOD_DEV);
+		if (error == 0 && dev == VNOVAL)
+			error = EINVAL;
 		break;
 	case S_IFMT:
 		error = priv_check(td, PRIV_VFS_MKNOD_BAD);


More information about the svn-src-head mailing list