linux/fs/orangefs
Jann Horn 78fee0b684 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 f7ab093f74 ("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>
2016-07-05 15:47:43 -04:00
..
acl.c orangefs: Remove useless xattr prefix arguments 2016-07-05 15:47:27 -04:00
dcache.c orangefs: use new getattr for revalidate and remove old getattr 2016-03-23 17:36:15 -04:00
devorangefs-req.c orangefs: fix namespace handling 2016-07-05 15:47:43 -04:00
dir.c orangefs: remove unused variable 2016-04-08 15:50:44 -04:00
downcall.h orangefs: use ORANGEFS_NAME_LEN everywhere; remove ORANGEFS_NAME_MAX 2016-02-24 17:07:50 -05:00
file.c orangefs: Remove useless xattr prefix arguments 2016-07-05 15:47:27 -04:00
inode.c Orangefs: allow O_DIRECT in open 2016-07-05 15:47:35 -04:00
Kconfig Orangefs: kernel client part 7 2015-10-03 11:40:00 -04:00
Makefile Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
namei.c orangefs: Avoid symlink upcall if target is too long. 2016-03-09 13:26:39 -05:00
orangefs-bufmap.c mm, fs: get rid of PAGE_CACHE_* and page_cache_{get,release} macros 2016-04-04 10:41:08 -07:00
orangefs-bufmap.h orangefs-bufmap.h: trim unused junk 2016-03-25 22:30:54 -04:00
orangefs-cache.c orangefs: fix namespace handling 2016-07-05 15:47:43 -04:00
orangefs-debug.h Orangef: remove overlooked old-style userspace debug parts 2015-12-11 11:00:12 -05:00
orangefs-debugfs.c Orangefs: fix ifnullfree.cocci warnings 2016-04-08 14:08:38 -04:00
orangefs-debugfs.h Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
orangefs-dev-proto.h orangefs: use ORANGEFS_NAME_LEN everywhere; remove ORANGEFS_NAME_MAX 2016-02-24 17:07:50 -05:00
orangefs-kernel.h orangefs: fix namespace handling 2016-07-05 15:47:43 -04:00
orangefs-mod.c orangefs: put register_chrdev immediately before register_filesystem 2016-03-17 14:34:10 -04:00
orangefs-sysfs.c Orangefs: fix sloppy cleanups of debugfs and sysfs init failures. 2016-03-14 15:48:28 -04:00
orangefs-sysfs.h Orangefs: change pvfs2 filenames to orangefs 2015-12-04 12:56:14 -05:00
orangefs-utils.c orangefs: fix namespace handling 2016-07-05 15:47:43 -04:00
protocol.h orangefs: Add KERN_<LEVEL> to gossip_<level> macros 2016-04-08 14:10:45 -04:00
super.c orangefs: fix orangefs_superblock locking 2016-03-26 07:22:00 -04:00
symlink.c Orangefs: follow_link -> get_link change 2016-03-14 15:48:28 -04:00
upcall.h orangefs: remove vestigial async io code 2016-02-24 17:07:50 -05:00
waitqueue.c Orangefs: improve gossip statements 2016-03-03 13:46:48 -05:00
xattr.c orangefs: fix namespace handling 2016-07-05 15:47:43 -04:00