All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Eric W. Biederman" <ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
Cc: "linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	richard.weinberger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	lkml <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Andy Lutomirski <luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org>,
	mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: For review: user_namespace(7) man page
Date: Tue, 09 Sep 2014 06:59:35 -0700	[thread overview]
Message-ID: <540F07C7.9000300@gmail.com> (raw)
In-Reply-To: <87d2bhfxvc.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>

Hi Eric,

On 08/30/2014 02:53 PM, Eric W. Biederman wrote:
> "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
> 
>> Hello Eric et al.,
>>
>> For various reasons, my work on the namespaces man pages 
>> fell off the table a while back. Nevertheless, the pages have
>> been close to completion for a while now, and I recently restarted,
>> in an effort to finish them. As you also noted to me f2f, there have
>> been recently been some small namespace changes that you may affect
>> the content of the pages. Therefore, I'll take the opportunity to
>> send the namespace-related pages out for further (final?) review.
>>
>> So, here, I start with the user_namespaces(7) page, which is shown 
>> in rendered form below, with source attached to this mail. I'll
>> send various other pages in follow-on mails.
>>
>> Review comments/suggestions for improvements / bug fixes welcome.
>>
>> Cheers,
>>
>> Michael
>>
>> ==
>>
>> NAME
>>        user_namespaces - overview of Linux user_namespaces
>>
[...]

>>        When a new IPC, mount, network, PID, or UTS namespace is  created
>>        via clone(2) or unshare(2), the kernel records the user namespace
>>        of the creating process against the new namespace.  (This associ‐
>>        ation  can't  be  changed.)   When a process in the new namespace
>>        subsequently  performs  privileged  operations  that  operate  on
>>        global resources isolated by the namespace, the permission checks
>>        are performed according to the process's capabilities in the user
>>        namespace that the kernel associated with the new namespace.
> 
> Restrictions on mount namespaces.
> 
> - A mount namespace has a owner user namespace.  A mount namespace whose
>   owner user namespace is different than the owerner user namespace of
>   it's parent mount namespace is considered a less privileged mount
>   namespace.
> 
> - When creating a less privileged mount namespace shared mounts are
>   reduced to slave mounts.  This ensures that mappings performed in less
>   privileged mount namespaces will not propogate to more privielged
>   mount namespaces.
> 
> - Mounts that come as a single unit from more privileged mount are
>   locked together and may not be separated in a less privielged mount
>   namespace.

Could you clarify what you mean by "Mounts that come as a single unit"?
 
> - The mount flags readonly, nodev, nosuid, noexec, and the mount atime
>   settings when propogated from a more privielged to a less privileged
>   mount namespace become locked, and may not be changed in the less
>   privielged mount namespace.
> 
> - (As of 3.18-rc1 (in todays Al Viros vfs.git#for-next tree)) A file or
>   directory that is a mountpoint in one namespace that is not a mount
>   point in another namespace, may be renamed, unlinked, or rmdired in
>   the mount namespace in which it is not a mount namespace if the
>   ordinary permission checks pass.
> 
>   Previously attemping to rmdir, unlink or rename a file or directory
>   that was a mount point in another mount namespace would result in
>   -EBUSY.  This behavior had technical problems of enforcement (nfs)
>   and resulted in a nice denial of servial attack against more
>   privileged users.  (Aka preventing individual files from being updated
>   by bind mounting on top of them).

I have reworked the text above a little so that now we have the following.
Aside from question above, does it look okay?

   Restrictions on mount namespaces
       Note the following points with respect to mount namespaces:

       *  A  mount  namespace  has  na  owner user namespace.  A mount
          namespace whose owner user namespace is different  from  the
          owner  user  namespace of its parent mount namespace is con‐
          sidered a less privileged mount namespace.

       *  When creating a  less  privileged  mount  namespace,  shared
          mounts  are reduced to slave mounts.  This ensures that map‐
          pings performed in less privileged mount namespaces will not
          propagate to more privileged mount namespaces.

       *  Mounts that come as a single unit from more privileged mount
          are locked together and may not be separated in a less priv‐
          ileged mount namespace.

       *  The  mount(2) flags MS_RDONLY, MS_NOSUID, MS_NOEXEC, and the
          "atime" flags (MS_NOATIME, MS_NODIRATIME, MS_RELATIME)  set‐
          tings  become  locked when propagated from a more privileged
          to a less privileged mount namespace, and may not be changed
          in the less privileged mount namespace.

       *  A  file  or directory that is a mount point in one namespace
          that is not a mount  point  in  another  namespace,  may  be
          renamed, unlinked, or removed (rmdir(2)) in the mount names‐
          pace in which it is not a mount point (subject to the  usual
          permission checks).

          Previously,  attempting  to unlink, rename, or remove a file
          or directory that was a mount point in another mount  names‐
          pace  would  result  in  the error EBUSY.  That behavior had
          technical problems of enforcement (e.g., for NFS)  and  per‐
          mitted  denial-of-service  attacks  against  more privileged
          users.   (i.e.,  preventing  individual  files  from   being
          updated by bind mounting on top of them).

Cheers,

Michael





-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers

WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: mtk.manpages@gmail.com, lkml <linux-kernel@vger.kernel.org>,
	"linux-man@vger.kernel.org" <linux-man@vger.kernel.org>,
	containers@lists.linux-foundation.org,
	Andy Lutomirski <luto@amacapital.net>,
	richard.weinberger@gmail.com,
	"Serge E. Hallyn" <serge@hallyn.com>
Subject: Re: For review: user_namespace(7) man page
Date: Tue, 09 Sep 2014 06:59:35 -0700	[thread overview]
Message-ID: <540F07C7.9000300@gmail.com> (raw)
In-Reply-To: <87d2bhfxvc.fsf@x220.int.ebiederm.org>

Hi Eric,

On 08/30/2014 02:53 PM, Eric W. Biederman wrote:
> "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
> 
>> Hello Eric et al.,
>>
>> For various reasons, my work on the namespaces man pages 
>> fell off the table a while back. Nevertheless, the pages have
>> been close to completion for a while now, and I recently restarted,
>> in an effort to finish them. As you also noted to me f2f, there have
>> been recently been some small namespace changes that you may affect
>> the content of the pages. Therefore, I'll take the opportunity to
>> send the namespace-related pages out for further (final?) review.
>>
>> So, here, I start with the user_namespaces(7) page, which is shown 
>> in rendered form below, with source attached to this mail. I'll
>> send various other pages in follow-on mails.
>>
>> Review comments/suggestions for improvements / bug fixes welcome.
>>
>> Cheers,
>>
>> Michael
>>
>> ==
>>
>> NAME
>>        user_namespaces - overview of Linux user_namespaces
>>
[...]

>>        When a new IPC, mount, network, PID, or UTS namespace is  created
>>        via clone(2) or unshare(2), the kernel records the user namespace
>>        of the creating process against the new namespace.  (This associ‐
>>        ation  can't  be  changed.)   When a process in the new namespace
>>        subsequently  performs  privileged  operations  that  operate  on
>>        global resources isolated by the namespace, the permission checks
>>        are performed according to the process's capabilities in the user
>>        namespace that the kernel associated with the new namespace.
> 
> Restrictions on mount namespaces.
> 
> - A mount namespace has a owner user namespace.  A mount namespace whose
>   owner user namespace is different than the owerner user namespace of
>   it's parent mount namespace is considered a less privileged mount
>   namespace.
> 
> - When creating a less privileged mount namespace shared mounts are
>   reduced to slave mounts.  This ensures that mappings performed in less
>   privileged mount namespaces will not propogate to more privielged
>   mount namespaces.
> 
> - Mounts that come as a single unit from more privileged mount are
>   locked together and may not be separated in a less privielged mount
>   namespace.

Could you clarify what you mean by "Mounts that come as a single unit"?
 
> - The mount flags readonly, nodev, nosuid, noexec, and the mount atime
>   settings when propogated from a more privielged to a less privileged
>   mount namespace become locked, and may not be changed in the less
>   privielged mount namespace.
> 
> - (As of 3.18-rc1 (in todays Al Viros vfs.git#for-next tree)) A file or
>   directory that is a mountpoint in one namespace that is not a mount
>   point in another namespace, may be renamed, unlinked, or rmdired in
>   the mount namespace in which it is not a mount namespace if the
>   ordinary permission checks pass.
> 
>   Previously attemping to rmdir, unlink or rename a file or directory
>   that was a mount point in another mount namespace would result in
>   -EBUSY.  This behavior had technical problems of enforcement (nfs)
>   and resulted in a nice denial of servial attack against more
>   privileged users.  (Aka preventing individual files from being updated
>   by bind mounting on top of them).

I have reworked the text above a little so that now we have the following.
Aside from question above, does it look okay?

   Restrictions on mount namespaces
       Note the following points with respect to mount namespaces:

       *  A  mount  namespace  has  na  owner user namespace.  A mount
          namespace whose owner user namespace is different  from  the
          owner  user  namespace of its parent mount namespace is con‐
          sidered a less privileged mount namespace.

       *  When creating a  less  privileged  mount  namespace,  shared
          mounts  are reduced to slave mounts.  This ensures that map‐
          pings performed in less privileged mount namespaces will not
          propagate to more privileged mount namespaces.

       *  Mounts that come as a single unit from more privileged mount
          are locked together and may not be separated in a less priv‐
          ileged mount namespace.

       *  The  mount(2) flags MS_RDONLY, MS_NOSUID, MS_NOEXEC, and the
          "atime" flags (MS_NOATIME, MS_NODIRATIME, MS_RELATIME)  set‐
          tings  become  locked when propagated from a more privileged
          to a less privileged mount namespace, and may not be changed
          in the less privileged mount namespace.

       *  A  file  or directory that is a mount point in one namespace
          that is not a mount  point  in  another  namespace,  may  be
          renamed, unlinked, or removed (rmdir(2)) in the mount names‐
          pace in which it is not a mount point (subject to the  usual
          permission checks).

          Previously,  attempting  to unlink, rename, or remove a file
          or directory that was a mount point in another mount  names‐
          pace  would  result  in  the error EBUSY.  That behavior had
          technical problems of enforcement (e.g., for NFS)  and  per‐
          mitted  denial-of-service  attacks  against  more privileged
          users.   (i.e.,  preventing  individual  files  from   being
          updated by bind mounting on top of them).

Cheers,

Michael





-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

  parent reply	other threads:[~2014-09-09 13:59 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20 23:36 For review: user_namespace(7) man page Michael Kerrisk (man-pages)
2014-08-20 23:36 ` Michael Kerrisk (man-pages)
     [not found] ` <53F5310A.5080503-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-08-22 21:12   ` Serge E. Hallyn
2014-08-22 21:12     ` Serge E. Hallyn
     [not found]     ` <20140822211215.GA26308-7LNsyQBKDXoIagZqoN9o3w@public.gmane.org>
2014-09-01 16:58       ` Michael Kerrisk (man-pages)
2014-09-01 16:58         ` Michael Kerrisk (man-pages)
2014-08-30 21:53   ` Eric W. Biederman
2014-08-30 21:53     ` Eric W. Biederman
     [not found]     ` <87d2bhfxvc.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-01 17:31       ` Michael Kerrisk (man-pages)
2014-09-01 17:31         ` Michael Kerrisk (man-pages)
     [not found]         ` <5404AD7F.4070004-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-02  1:05           ` Eric W. Biederman
2014-09-02  1:05             ` Eric W. Biederman
     [not found]             ` <87sikade6s.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-09 14:00               ` Michael Kerrisk (man-pages)
2014-09-09 14:00                 ` Michael Kerrisk (man-pages)
     [not found]                 ` <540F07FD.7010106-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-09 16:16                   ` Eric W. Biederman
2014-09-09 16:16                     ` Eric W. Biederman
     [not found]                     ` <87bnqon513.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-11 14:40                       ` Michael Kerrisk (man-pages)
2014-09-11 14:40                         ` Michael Kerrisk (man-pages)
2014-09-01 17:31       ` Michael Kerrisk (man-pages)
2014-09-09 13:59       ` Michael Kerrisk (man-pages) [this message]
2014-09-09 13:59         ` Michael Kerrisk (man-pages)
     [not found]         ` <540F07C7.9000300-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-09 15:49           ` Eric W. Biederman
2014-09-09 15:49             ` Eric W. Biederman
     [not found]             ` <87sik0oktt.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-11 14:40               ` Michael Kerrisk (man-pages)
2014-09-11 14:40                 ` Michael Kerrisk (man-pages)
2014-09-09 13:59       ` Michael Kerrisk (man-pages)
2014-09-09 13:59         ` Michael Kerrisk (man-pages)
     [not found]         ` <540F07CD.3080708-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-09 15:51           ` Eric W. Biederman
2014-09-09 15:51             ` Eric W. Biederman
     [not found]             ` <87oauookq2.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-11 14:40               ` Michael Kerrisk (man-pages)
2014-09-11 14:40                 ` Michael Kerrisk (man-pages)
2014-09-01 20:57   ` Andy Lutomirski
2014-09-01 20:57     ` Andy Lutomirski
     [not found]     ` <CALCETrX2qwvzmeoVcLFLxEK=1Fv+f0Ri0TouzzvbN_rgDjka4A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-09 14:00       ` Michael Kerrisk (man-pages)
2014-09-09 14:00         ` Michael Kerrisk (man-pages)
     [not found]         ` <540F0810.7030408-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-09 16:05           ` Eric W. Biederman
2014-09-09 16:05             ` Eric W. Biederman
     [not found]             ` <87ppf4n5ib.fsf-JOvCrm2gF+uungPnsOpG7nhyD016LWXt@public.gmane.org>
2014-09-09 19:26               ` Andy Lutomirski
2014-09-09 19:26                 ` Andy Lutomirski
     [not found]                 ` <CALCETrV4WizRXD9JuwibUBbQE9hhNrRDJ3cYyXdhd=OfPziF5g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-09 19:39                   ` Andy Lutomirski
2014-09-09 19:39                     ` Andy Lutomirski
2014-09-11 14:47                   ` Michael Kerrisk (man-pages)
2014-09-11 14:47                     ` Michael Kerrisk (man-pages)
     [not found]                     ` <5411B5F5.2090500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-11 15:15                       ` Andy Lutomirski
2014-09-11 15:15                         ` Andy Lutomirski
     [not found]                         ` <CALCETrXOgCUrrzeJYJ6VoPgR5Rt0HFCrhRC0H7+3XLv1Y+sJ_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-14  2:58                           ` Michael Kerrisk (man-pages)
2014-09-14  2:58                             ` Michael Kerrisk (man-pages)
2014-09-14  2:58                           ` Michael Kerrisk (man-pages)
2014-09-11 14:46               ` Michael Kerrisk (man-pages)
2014-09-11 14:46                 ` Michael Kerrisk (man-pages)
     [not found]                 ` <5411B5D6.9010201-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-09-11 15:14                   ` Andy Lutomirski
2014-09-11 15:14                     ` Andy Lutomirski
     [not found]                     ` <CALCETrV1EtrzfEhS55ToPD5VTbY9VjmmOA6bv2H9PGGQ-G=WGA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-09-14  2:42                       ` Michael Kerrisk (man-pages)
2014-09-14  2:42                         ` Michael Kerrisk (man-pages)
2014-09-14  2:42                       ` Michael Kerrisk (man-pages)
2014-09-11 14:46               ` Michael Kerrisk (man-pages)
  -- strict thread matches above, loose matches on Subject: below --
2014-08-20 23:36 Michael Kerrisk (man-pages)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=540F07C7.9000300@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=luto-kltTT9wpgjJwATOyAt5JVQ@public.gmane.org \
    --cc=richard.weinberger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.