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.
This commit is contained in:
kib 2015-01-04 00:49:45 +00:00
parent 511130787f
commit 315194d815
3 changed files with 5 additions and 1 deletions

View File

@ -3177,7 +3177,8 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
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

View File

@ -215,6 +215,8 @@ vn_open_cred(struct nameidata *ndp, int *flagp, int cmode, u_int vn_open_flags,
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);

View File

@ -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.