svn commit: r276008 - in head/sys: kern sys
Konstantin Belousov
kib at FreeBSD.org
Sun Dec 21 13:32:09 UTC 2014
Author: kib
Date: Sun Dec 21 13:32:07 2014
New Revision: 276008
URL: https://svnweb.freebsd.org/changeset/base/276008
Log:
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.
Requested by: rpaulo
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Modified:
head/sys/kern/kern_sig.c
head/sys/kern/vfs_vnops.c
head/sys/sys/vnode.h
Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c Sun Dec 21 13:29:33 2014 (r276007)
+++ head/sys/kern/kern_sig.c Sun Dec 21 13:32:07 2014 (r276008)
@@ -3167,7 +3167,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: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c Sun Dec 21 13:29:33 2014 (r276007)
+++ head/sys/kern/vfs_vnops.c Sun Dec 21 13:32:07 2014 (r276008)
@@ -217,6 +217,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: head/sys/sys/vnode.h
==============================================================================
--- head/sys/sys/vnode.h Sun Dec 21 13:29:33 2014 (r276007)
+++ head/sys/sys/vnode.h Sun Dec 21 13:32:07 2014 (r276008)
@@ -580,6 +580,7 @@ typedef void vop_getpages_iodone_t(void
/* 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-head
mailing list