From 5158c93ca872f18270b2f4e6b8f36d44a1df187b Mon Sep 17 00:00:00 2001 From: anton Date: Thu, 19 Mar 2020 13:55:21 +0000 Subject: 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@ --- sys/kern/kern_unveil.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'sys/kern/kern_unveil.c') 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 @@ -38,6 +38,23 @@ #include +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; } -- cgit v1.2.3