diff options
author | Jann Horn <jannh@google.com> | 2016-06-24 23:51:52 (GMT) |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2016-07-05 19:47:43 (GMT) |
commit | 78fee0b6846f27872321338db6afe280f059ae99 (patch) | |
tree | 6a892ab00e37596ab8bbde5b58732799af3c4616 /fs/orangefs/xattr.c | |
parent | 3903f1500832be699fe746ada29dd6bec126d62e (diff) | |
download | linux-78fee0b6846f27872321338db6afe280f059ae99.tar.xz |
orangefs: fix namespace handling
In orangefs_inode_getxattr(), an fsuid is written to dmesg. The kuid is
converted to a userspace uid via from_kuid(current_user_ns(), [...]), but
since dmesg is global, init_user_ns should be used here instead.
In copy_attributes_from_inode(), op_alloc() and fill_default_sys_attrs(),
upcall structures are populated with uids/gids that have been mapped into
the caller's namespace. However, those upcall structures are read by
another process (the userspace filesystem driver), and that process might
be running in another namespace. This effectively lets any user spoof its
uid and gid as seen by the userspace filesystem driver.
To fix the second issue, I just construct the opcall structures with
init_user_ns uids/gids and require the filesystem server to run in the
init namespace. Since orangefs is full of global state anyway (as the error
message in DUMP_DEVICE_ERROR explains, there can only be one userspace
orangefs filesystem driver at once), that shouldn't be a problem.
[
Why does orangefs even exist in the kernel if everything does upcalls into
userspace? What does orangefs do that couldn't be done with the FUSE
interface? If there is no good answer to those questions, I'd prefer to see
orangefs kicked out of the kernel. Can that be done for something that
shipped in a release?
According to commit f7ab093f74bf ("Orangefs: kernel client part 1"), they
even already have a FUSE daemon, and the only rational reason (apart from
"but most of our users report preferring to use our kernel module instead")
given for not wanting to use FUSE is one "in-the-works" feature that could
probably be integated into FUSE instead.
]
This patch has been compile-tested.
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/xattr.c')
-rw-r--r-- | fs/orangefs/xattr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c index 73a0c34..2a9f07f 100644 --- a/fs/orangefs/xattr.c +++ b/fs/orangefs/xattr.c @@ -79,8 +79,8 @@ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name, return -EINVAL; } - fsuid = from_kuid(current_user_ns(), current_fsuid()); - fsgid = from_kgid(current_user_ns(), current_fsgid()); + fsuid = from_kuid(&init_user_ns, current_fsuid()); + fsgid = from_kgid(&init_user_ns, current_fsgid()); gossip_debug(GOSSIP_XATTR_DEBUG, "getxattr on inode %pU, name %s " |