]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "mqueue: switch to on-demand creation of internal mount"
authorEric W. Biederman <ebiederm@xmission.com>
Sat, 24 Mar 2018 16:28:14 +0000 (11:28 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Sun, 25 Mar 2018 00:34:23 +0000 (19:34 -0500)
commit2c6b9cee4439b5c20558fe1e54ee488b1ce94c8b
tree1836d4f17e9e7a99f49e9810ff14f0b65389b572
parent22824f5281ac26627bdbd95a71590b265bd292da
Revert "mqueue: switch to on-demand creation of internal mount"

This reverts commit 6ede72279479eb44b1aec82b33da730fa6a33c62.

Aleksa Sarai <asarai@suse.de> writes:
> [REGRESSION v4.16-rc6] [PATCH] mqueue: forbid unprivileged user access to internal mount
>
> Felix reported weird behaviour on 4.16.0-rc6 with regards to mqueue[1],
> which was introduced by 6ede72279479 ("mqueue: switch to on-demand
> creation of internal mount").
>
> Basically, the reproducer boils down to being able to mount mqueue if
> you create a new user namespace, even if you don't unshare the IPC
> namespace.
>
> Previously this was not possible, and you would get an -EPERM. The mount
> is the *host* mqueue mount, which is being cached and just returned from
> mqueue_mount(). To be honest, I'm not sure if this is safe or not (or if
> it was intentional -- since I'm not familiar with mqueue).
>
> To me it looks like there is a missing permission check. I've included a
> patch below that I've compile-tested, and should block the above case.
> Can someone please tell me if I'm missing something? Is this actually
> safe?
>
> [1]: https://github.com/docker/docker/issues/36674

The issue is a lot deeper than a missing permission check.  sb->s_user_ns
was is improperly set as well.  So in addition to the filesystem being
mounted when it should not be mounted, so things are not allow that should
be.

We are practically to the release of 4.16 and there is no agreement between
Al Viro and myself on what the code should looks like to fix things properly.
So revert the code to what it was before so that we can take our time
and discuss this properly.

Fixes: 6ede72279479 ("mqueue: switch to on-demand creation of internal mount")
Reported-by: Felix Abecassis <fabecassis@nvidia.com>
Reported-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
ipc/mqueue.c