chiark / gitweb /
logind: fix /run/user/$UID creation in apparmor-confined containers (#4154)
authorTomáš Janoušek <tomi@nomi.cz>
Thu, 15 Sep 2016 23:26:31 +0000 (01:26 +0200)
committerSven Eden <yamakuzure@gmx.net>
Wed, 5 Jul 2017 06:50:53 +0000 (08:50 +0200)
commit6b0862dad14eedfa49119f13dfcaf572c7313669
tree7a50627763bf1911788d63e2efe7bacd16f30426
parent24ab3b695eae442c47f5f67a0b4fc504c0044f98
logind: fix /run/user/$UID creation in apparmor-confined containers (#4154)

When a docker container is confined with AppArmor [1] and happens to run
on top of a kernel that supports mount mediation [2], e.g. any Ubuntu
kernel, mount(2) returns EACCES instead of EPERM.  This then leads to:

    elogind-logind[33]: Failed to mount per-user tmpfs directory /run/user/1000: Permission denied
    login[42]: pam_elogind(login:session): Failed to create session: Access denied

and user sessions don't start.

This also applies to selinux that too returns EACCES on mount denial.

[1] https://github.com/docker/docker/blob/master/docs/security/apparmor.md#understand-the-policies
[2] http://bazaar.launchpad.net/~apparmor-dev/apparmor/master/view/head:/kernel-patches/4.7/0025-UBUNTU-SAUCE-apparmor-Add-the-ability-to-mediate-mou.patch
src/login/logind-user.c