Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jul 2016 09:23:19 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302893 - head/sys/kern
Message-ID:  <201607150923.u6F9NJLS064889@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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