diff options
author | anton <anton@cvs.openbsd.org> | 2020-03-19 13:55:21 +0000 |
---|---|---|
committer | anton <anton@cvs.openbsd.org> | 2020-03-19 13:55:21 +0000 |
commit | 5158c93ca872f18270b2f4e6b8f36d44a1df187b (patch) | |
tree | b64d5a0ffc5c003155b4f15ffb732d57fa32af1e /sys/kern/kern_unveil.c | |
parent | 995096b1833d207c16d9568961c882fa09bb5214 (diff) |
Move unveil data structures away from the proc.h header into the
implementation file. Pushing the assignment of ps_uvpcwd down to
unveil_add() is required but it doesn't introduce any functional change.
ok mpi@ semarie@
Diffstat (limited to 'sys/kern/kern_unveil.c')
-rw-r--r-- | sys/kern/kern_unveil.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/kern/kern_unveil.c b/sys/kern/kern_unveil.c index 1a2f281e94b..31a52b89d13 100644 --- a/sys/kern/kern_unveil.c +++ b/sys/kern/kern_unveil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_unveil.c,v 1.36 2020/01/22 07:52:37 deraadt Exp $ */ +/* $OpenBSD: kern_unveil.c,v 1.37 2020/03/19 13:55:20 anton Exp $ */ /* * Copyright (c) 2017-2019 Bob Beck <beck@openbsd.org> @@ -38,6 +38,23 @@ #include <sys/pledge.h> +struct unvname { + char *un_name; + size_t un_namesize; + u_char un_flags; + RBT_ENTRY(unvnmae) un_rbt; +}; + +RBT_HEAD(unvname_rbt, unvname); + +struct unveil { + struct vnode *uv_vp; + ssize_t uv_cover; + struct unvname_rbt uv_names; + struct rwlock uv_lock; + u_char uv_flags; +}; + /* #define DEBUG_UNVEIL */ #define UNVEIL_MAX_VNODES 128 @@ -639,6 +656,15 @@ unveil_add(struct proc *p, struct nameidata *ndp, const char *permissions) done: if (ret == 0) unveil_add_traversed_vnodes(p, ndp); + + pr->ps_uvpcwd = unveil_lookup(p->p_fd->fd_cdir, pr, NULL); + if (pr->ps_uvpcwd == NULL) { + ssize_t i = unveil_find_cover(p->p_fd->fd_cdir, p); + + if (i >= 0) + pr->ps_uvpcwd = &pr->ps_uvpaths[i]; + } + return ret; } |