From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael Kerrisk (man-pages)" Subject: Re: For review: user_namespace(7) man page Date: Thu, 11 Sep 2014 07:47:17 -0700 Message-ID: <5411B5F5.2090500@gmail.com> References: <53F5310A.5080503@gmail.com> <540F0810.7030408@gmail.com> <87ppf4n5ib.fsf@x220.int.ebiederm.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Andy Lutomirski , "Eric W. Biederman" Cc: "linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , richard -rw- weinberger , Linux Containers , lkml , mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org List-Id: linux-man@vger.kernel.org Hi Andy, On 09/09/2014 12:26 PM, Andy Lutomirski wrote: > On Tue, Sep 9, 2014 at 9:05 AM, Eric W. Biederman wrote: >> >> We may also want to discuss the specific restrictions on chroot. >> >> The text about chroot at least gives people a strong hint that the >> chroot rules are affected by user namespaces. >> >> The restrictions that we have settled on to avoid chroot being a problem >> are the creator of a user namespace must not be chrooted in their >> current mount namespace, and the creator of the user namespace must not >> be threaded. >> >> Andy can you check me on this it looks like unshare is currently buggy >> in that it will allow a threaded application to create a user namespace. > > I think it's this code in unshare: > > /* > * If unsharing a user namespace must also unshare the thread. > */ > if (unshare_flags & CLONE_NEWUSER) > unshare_flags |= CLONE_THREAD | CLONE_FS; > > I suppose that this should be documented. > > CLONE_FS prevents the chroot from leaking out of the namespace. (But > see the other thread that I'm about to start...) So, in the current draft of the setns(2) page, there is CLONE_NEWNS ... Since Linux 3.9, CLONE_NEWUSER also automatically implies CLONE_FS. Does that cover your point? Or did you mean that more needs to be said? Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/