diff options
author | 2018-06-19 11:27:54 +0000 | |
---|---|---|
committer | 2018-06-19 11:27:54 +0000 | |
commit | 413ec31c49a681fcd185c34be06e8b17074efb80 (patch) | |
tree | 00024a07b506cfbfe5fca9a12fded7b340ebe828 /sys/miscfs | |
parent | describe more supported hardware (diff) | |
download | wireguard-openbsd-413ec31c49a681fcd185c34be06e8b17074efb80.tar.xz wireguard-openbsd-413ec31c49a681fcd185c34be06e8b17074efb80.zip |
Send the calling thread id, effective uid and gid, and umask to the
FUSE file system. fuse_get_context(3) will now return the correct
values.
ok mpi@
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/fuse/fusebuf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/sys/miscfs/fuse/fusebuf.c b/sys/miscfs/fuse/fusebuf.c index 869889f84d4..edc5a9ca3d2 100644 --- a/sys/miscfs/fuse/fusebuf.c +++ b/sys/miscfs/fuse/fusebuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fusebuf.c,v 1.14 2018/05/23 13:09:37 helg Exp $ */ +/* $OpenBSD: fusebuf.c,v 1.15 2018/06/19 11:27:54 helg Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -16,9 +16,11 @@ */ #include <sys/param.h> +#include <sys/filedesc.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/pool.h> +#include <sys/proc.h> #include <sys/stat.h> #include <sys/statvfs.h> #include <sys/systm.h> @@ -39,6 +41,14 @@ fb_setup(size_t len, ino_t ino, int op, struct proc *p) arc4random_buf(&fbuf->fb_uuid, sizeof fbuf->fb_uuid); fbuf->fb_type = op; fbuf->fb_ino = ino; + /* + * When exposed to userspace, thread IDs have THREAD_PID_OFFSET added + * to keep them from overlapping the PID range. + */ + fbuf->fb_tid = p->p_tid + THREAD_PID_OFFSET; + fbuf->fb_uid = p->p_ucred->cr_uid; + fbuf->fb_gid = p->p_ucred->cr_gid; + fbuf->fb_umask = p->p_p->ps_fd->fd_cmask; if (len == 0) fbuf->fb_dat = NULL; else |