Message ID | 20190617184711.21364-1-christian@brauner.io (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | fs/namespace: fix unprivileged mount propagation | expand |
On Mon, Jun 17, 2019 at 11:47 AM Christian Brauner <christian@brauner.io> wrote: > > When propagating mounts across mount namespaces owned by different user > namespaces it is not possible anymore to move or umount the mount in the > less privileged mount namespace. I will wait a short while in the hope of getting Al's ack for this, but since it looks about as good as it likely can be, I suspect I'll just apply it later today even without such an ack.. Linus
On Mon, Jun 17, 2019 at 11:50:13AM -0700, Linus Torvalds wrote: > On Mon, Jun 17, 2019 at 11:47 AM Christian Brauner <christian@brauner.io> wrote: > > > > When propagating mounts across mount namespaces owned by different user > > namespaces it is not possible anymore to move or umount the mount in the > > less privileged mount namespace. > > I will wait a short while in the hope of getting Al's ack for this, > but since it looks about as good as it likely can be, I suspect I'll > just apply it later today even without such an ack.. Thanks! Note that I stupidly messed up whitespace by accidently adding an additional newline. I'll just send a v1 that fixes this nonsense. Christian
On Mon, Jun 17, 2019 at 11:50:13AM -0700, Linus Torvalds wrote: > On Mon, Jun 17, 2019 at 11:47 AM Christian Brauner <christian@brauner.io> wrote: > > > > When propagating mounts across mount namespaces owned by different user > > namespaces it is not possible anymore to move or umount the mount in the > > less privileged mount namespace. > > I will wait a short while in the hope of getting Al's ack for this, > but since it looks about as good as it likely can be, I suspect I'll > just apply it later today even without such an ack.. Give me a bit; I'm busy digging myself from under the pile of mail accumulated in the last few weeks (bronchitis sucked, especially when it got to the point where one can't stay asleep for more than an hour or get more than about 5 hours per day total). I'm trying not to throw anything relevant out, but if I don't reply to something important today or tomorrow, please resend it my way - the pile had been 36Kmail (down to 24K now) ;-/
diff --git a/fs/namespace.c b/fs/namespace.c index b26778bdc236..44b540e6feb9 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -2105,6 +2105,7 @@ static int attach_recursive_mnt(struct mount *source_mnt, /* Notice when we are propagating across user namespaces */ if (child->mnt_parent->mnt_ns->user_ns != user_ns) lock_mnt_tree(child); + child->mnt.mnt_flags &= ~MNT_LOCKED; commit_tree(child); } put_mountpoint(smp); diff --git a/fs/pnode.c b/fs/pnode.c index 595857a1883e..d118106fa631 100644 --- a/fs/pnode.c +++ b/fs/pnode.c @@ -257,11 +257,10 @@ static int propagate_one(struct mount *m) if (IS_MNT_SHARED(m)) type |= CL_MAKE_SHARED; } - + child = copy_tree(last_source, last_source->mnt.mnt_root, type); if (IS_ERR(child)) return PTR_ERR(child); - child->mnt.mnt_flags &= ~MNT_LOCKED; mnt_set_mountpoint(m, mp, child); last_dest = m; last_source = child;