- since mknod now can create regular files, make sure veriexec allows it.
Done in a way to minimize ifdefs. Per discussions with elad.
This commit is contained in:
parent
b0d544666a
commit
50ab9d6934
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: vfs_syscalls.c,v 1.313 2007/05/15 19:47:45 elad Exp $ */
|
/* $NetBSD: vfs_syscalls.c,v 1.314 2007/05/17 00:46:30 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
@ -37,7 +37,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.313 2007/05/15 19:47:45 elad Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.314 2007/05/17 00:46:30 christos Exp $");
|
||||||
|
|
||||||
#include "opt_compat_netbsd.h"
|
#include "opt_compat_netbsd.h"
|
||||||
#include "opt_compat_43.h"
|
#include "opt_compat_43.h"
|
||||||
@ -776,8 +776,6 @@ done:
|
|||||||
size_t len;
|
size_t len;
|
||||||
char *bp;
|
char *bp;
|
||||||
char *path = PNBUF_GET();
|
char *path = PNBUF_GET();
|
||||||
if (!path)
|
|
||||||
return ENOMEM;
|
|
||||||
|
|
||||||
bp = path + MAXPATHLEN;
|
bp = path + MAXPATHLEN;
|
||||||
*--bp = '\0';
|
*--bp = '\0';
|
||||||
@ -1754,6 +1752,7 @@ sys_mknod(struct lwp *l, void *v, register_t *retval)
|
|||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
struct vattr vattr;
|
struct vattr vattr;
|
||||||
int error, optype;
|
int error, optype;
|
||||||
|
char *path;
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
|
|
||||||
if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MKNOD,
|
if ((error = kauth_authorize_system(l->l_cred, KAUTH_SYSTEM_MKNOD,
|
||||||
@ -1761,9 +1760,13 @@ sys_mknod(struct lwp *l, void *v, register_t *retval)
|
|||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
optype = VOP_MKNOD_DESCOFFSET;
|
optype = VOP_MKNOD_DESCOFFSET;
|
||||||
NDINIT(&nd, CREATE, LOCKPARENT | TRYEMULROOT, UIO_USERSPACE, SCARG(uap, path), l);
|
path = PNBUF_GET();
|
||||||
|
error = copyinstr(SCARG(uap, path), path, MAXPATHLEN, NULL);
|
||||||
|
if (error)
|
||||||
|
goto out;
|
||||||
|
NDINIT(&nd, CREATE, LOCKPARENT | TRYEMULROOT, UIO_SYSSPACE, path, l);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
goto out;
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
if (vp != NULL)
|
if (vp != NULL)
|
||||||
error = EEXIST;
|
error = EEXIST;
|
||||||
@ -1787,6 +1790,10 @@ sys_mknod(struct lwp *l, void *v, register_t *retval)
|
|||||||
optype = VOP_WHITEOUT_DESCOFFSET;
|
optype = VOP_WHITEOUT_DESCOFFSET;
|
||||||
break;
|
break;
|
||||||
case S_IFREG:
|
case S_IFREG:
|
||||||
|
#if NVERIEXEC > 0
|
||||||
|
error = veriexec_openchk(l, nd.ni_vp, nd.ni_dirp,
|
||||||
|
O_CREAT);
|
||||||
|
#endif /* NVERIEXEC > 0 */
|
||||||
vattr.va_type = VREG;
|
vattr.va_type = VREG;
|
||||||
vattr.va_rdev = VNOVAL;
|
vattr.va_rdev = VNOVAL;
|
||||||
optype = VOP_CREATE_DESCOFFSET;
|
optype = VOP_CREATE_DESCOFFSET;
|
||||||
@ -1829,6 +1836,8 @@ sys_mknod(struct lwp *l, void *v, register_t *retval)
|
|||||||
if (vp)
|
if (vp)
|
||||||
vrele(vp);
|
vrele(vp);
|
||||||
}
|
}
|
||||||
|
out:
|
||||||
|
PNBUF_PUT(path);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user