From mboxrd@z Thu Jan 1 00:00:00 1970 From: ebiederm@xmission.com (Eric W. Biederman) Subject: Re: [fuse-devel] fuse_get_context() and namespaces Date: Fri, 22 May 2015 12:44:35 -0500 Message-ID: <87iobk4id8.fsf@x220.int.ebiederm.org> References: <20150331011423.GC13083@unsen.q53.spb.ru> <20150401155515.GA2994@unsen.q53.spb.ru> <20150502155623.GD13083@unsen.q53.spb.ru> <20150522144702.GA126334@ubuntu-hedt> Mime-Version: 1.0 Content-Type: text/plain Cc: Miklos Szeredi , alexey@kurnosov.spb.ru, Andy Lutomirski , Serge Hallyn , fuse-devel , Linux-Fsdevel , Kernel Mailing List To: Seth Forshee Return-path: Received: from out03.mta.xmission.com ([166.70.13.233]:44694 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757476AbbEVRt2 (ORCPT ); Fri, 22 May 2015 13:49:28 -0400 In-Reply-To: <20150522144702.GA126334@ubuntu-hedt> (Seth Forshee's message of "Fri, 22 May 2015 09:47:02 -0500") Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Seth Forshee writes: > On Fri, May 22, 2015 at 04:23:55PM +0200, Miklos Szeredi wrote: >> On Sat, May 2, 2015 at 5:56 PM, wrote: >> > >> > 3.10.0-229 form Scientific Linux and native 4.0.1-1 (from elrepo). >> > SL 7.1 on the host and SL 6.6 on the LXC guest. At least in 3.10 >> > the 499dcf2024092e5cce41d05599a5b51d1f92031a is present. >> > Steps to reproduce: >> > >> > On first console: >> > [root@sl7test ~]# lxc-start -n test-2 /bin/su - >> > [root@test-2 ~]# diff -u hello.py /usr/share/doc/fuse-python-0.2.1/example/hello.py >> > --- hello.py 2015-05-02 11:12:13.963093580 -0400 >> > +++ /usr/share/doc/fuse-python-0.2.1/example/hello.py 2010-04-14 18:29:21.000000000 -0400 >> > @@ -41,8 +41,6 @@ >> > class HelloFS(Fuse): >> > >> > def getattr(self, path): >> > - dic = Fuse.GetContext(self) >> > - print dic >> > st = MyStat() >> > if path == '/': >> > st.st_mode = stat.S_IFDIR | 0755 >> > [root@test-2 ~]# python hello.py -f /mnt/ >> > >> > On second console: >> > [root@test-2 ~]# echo $$ >> > 41 >> > [root@test-2 ~]# ls /mnt/ >> > hello >> > >> > Output of first console: >> > {'gid': 0, 'pid': 12083, 'uid': 0} >> >> Thanks. >> >> Digging in mailbox... There was a thread last year about adding >> support for running fuse daemon in a container: >> >> http://thread.gmane.org/gmane.linux.kernel/1811658 >> >> Not sure what happened, but no updated patches have been posted or >> maybe I just missed them. > > I haven't sent updated patches in a while. I still intend to, but I > shifted focus to first getting general support for mounts from user > namespaces into the vfs (which will give a clearer direction for some of > the concerns raised about the fuse patches). > > All of this code is available in the userns-mounts branch of > git://kernel.ubuntu.com/sforshee/linux.git, and I don't think the fuse > patches actually depend on any of the stuff that precedes them. I'm > planning to start submitting some of the earlier patches from that > branch soon, and eventually get back to resubmitting the fuse patches. > > This is about pid namespaces though, and the fuse pid namespace patch > from that series (see below) should be more or less independent of the > rest of the patches. Potentially that could be merged separately from > the user namespae stuff. [snip] > @@ -2076,7 +2077,15 @@ static int convert_fuse_file_lock(const struct fuse_file_lock *ffl, > > fl->fl_start = ffl->start; > fl->fl_end = ffl->end; > - fl->fl_pid = ffl->pid; > + > + /* > + * Convert pid into the connection's pid namespace. If the > + * pid does not map into the namespace fl_pid will get set > + * to 0. > + */ > + rcu_read_lock(); > + fl->fl_pid = pid_vnr(find_pid_ns(ffl->pid, fc->pid_ns)); > + rcu_read_unlock(); Scratches my head. This looks wrong. I would have expected pid_nr_ns. Am I missing something reading this patch quickly? Eric