]> asedeno.scripts.mit.edu Git - linux.git/commit
fuse: Remove the buggy retranslation of pids in fuse_dev_do_read
authorEric W. Biederman <ebiederm@xmission.com>
Wed, 21 Feb 2018 02:25:20 +0000 (20:25 -0600)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 20 Mar 2018 16:11:44 +0000 (17:11 +0100)
commitdbf107b2a7f36fa635b40e0b554514f599c75b33
tree1eda69820bfa4674be9c8419c2a26cf3ffbad537
parent3b7008b226f3de811d4ac34238e9cf670f7c9fe7
fuse: Remove the buggy retranslation of pids in fuse_dev_do_read

At the point of fuse_dev_do_read the user space process that initiated the
action on the fuse filesystem may no longer exist.  The process have been
killed or may have fired an asynchronous request and exited.

If the initial process has exited, the code "pid_vnr(find_pid_ns(in->h.pid,
fc->pid_ns)" will either return a pid of 0, or in the unlikely event that
the pid has been reallocated it can return practically any pid.  Any pid is
possible as the pid allocator allocates pid numbers in different pid
namespaces independently.

The only way to make translation in fuse_dev_do_read reliable is to call
get_pid in fuse_req_init_context, and pid_vnr followed by put_pid in
fuse_dev_do_read.  That reference counting in other contexts has been shown
to bounce cache lines between processors and in general be slow.  So that
is not desirable.

The only known user of running the fuse server in a different pid namespace
from the filesystem does not care what the pids are in the fuse messages so
removing this code should not matter.

Getting the translation to a server running outside of the pid namespace of
a container can still be achieved by playing setns games at mount time.  It
is also possible to add an option to pass a pid namespace into the fuse
filesystem at mount time.

Fixes: 5d6d3a301c4e ("fuse: allow server to run in different pid_ns")
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dev.c