svn commit: r276649 - in stable/10/sys: kern sys

Konstantin Belousov kib at FreeBSD.org
Sun Jan 4 00:49:47 UTC 2015


Author: kib
Date: Sun Jan  4 00:49:45 2015
New Revision: 276649
URL: https://svnweb.freebsd.org/changeset/base/276649

Log:
  MFC r276008:
  Add VN_OPEN_NAMECACHE flag for vn_open_cred(9), which requests that
  the created file name was cached.  Use the flag for core dumps.

Modified:
  stable/10/sys/kern/kern_sig.c
  stable/10/sys/kern/vfs_vnops.c
  stable/10/sys/sys/vnode.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/kern_sig.c
==============================================================================
--- stable/10/sys/kern/kern_sig.c	Sun Jan  4 00:46:06 2015	(r276648)
+++ stable/10/sys/kern/kern_sig.c	Sun Jan  4 00:49:45 2015	(r276649)
@@ -3177,7 +3177,8 @@ corefile_open(const char *comm, uid_t ui
 	sbuf_delete(&sb);
 
 	cmode = S_IRUSR | S_IWUSR;
-	oflags = VN_OPEN_NOAUDIT | (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
+	oflags = VN_OPEN_NOAUDIT | VN_OPEN_NAMECACHE |
+	    (capmode_coredump ? VN_OPEN_NOCAPCHECK : 0);
 
 	/*
 	 * If the core format has a %I in it, then we need to check

Modified: stable/10/sys/kern/vfs_vnops.c
==============================================================================
--- stable/10/sys/kern/vfs_vnops.c	Sun Jan  4 00:46:06 2015	(r276648)
+++ stable/10/sys/kern/vfs_vnops.c	Sun Jan  4 00:49:45 2015	(r276649)
@@ -215,6 +215,8 @@ restart:
 					return (error);
 				goto restart;
 			}
+			if ((vn_open_flags & VN_OPEN_NAMECACHE) != 0)
+				ndp->ni_cnd.cn_flags |= MAKEENTRY;
 #ifdef MAC
 			error = mac_vnode_check_create(cred, ndp->ni_dvp,
 			    &ndp->ni_cnd, vap);

Modified: stable/10/sys/sys/vnode.h
==============================================================================
--- stable/10/sys/sys/vnode.h	Sun Jan  4 00:46:06 2015	(r276648)
+++ stable/10/sys/sys/vnode.h	Sun Jan  4 00:49:45 2015	(r276649)
@@ -577,6 +577,7 @@ vn_canvmio(struct vnode *vp)
 /* vn_open_flags */
 #define	VN_OPEN_NOAUDIT		0x00000001
 #define	VN_OPEN_NOCAPCHECK	0x00000002
+#define	VN_OPEN_NAMECACHE	0x00000004
 
 /*
  * Public vnode manipulation functions.


More information about the svn-src-stable-10 mailing list