]> 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)
commit15275407a6ca2584eb4747a05bab035eaee3e7b1
tree1836d4f17e9e7a99f49e9810ff14f0b65389b572
parentec86ef94f7e7b4fb720bc80e7ffb57326f152ab0
Revert "mqueue: switch to on-demand creation of internal mount"

This reverts commit 9136b404299ab22c43d520eb6be014e35ee3f858.

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 9136b404299a ("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: 9136b404299a ("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