chiark / gitweb /
core: dont't remount /sys/fs/cgroup for relabel if not needed (#8595)
authorKrzysztof Nowicki <krzysztof.a.nowicki+github@gmail.com>
Wed, 28 Mar 2018 11:36:33 +0000 (13:36 +0200)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
commiteb015030c455526dea8fdf731414ea60081067bf
tree681415589d0581e747ef192deed7b6dba7c131f9
parent09642eb180f91ac1a4147a477b2e69d4afb29369
core: dont't remount /sys/fs/cgroup for relabel if not needed (#8595)

The initial fix for relabelling the cgroup filesystem for
SELinux delivered in commit 8739f23e3 was based on the assumption that
the cgroup filesystem is already populated once mount_setup() is
executed, which was true for my system. What I wasn't aware is that this
is the case only when another instance of systemd was running before
this one, which can happen if systemd is used in the initrd (for ex. by
dracut).

In case of a clean systemd start-up the cgroup filesystem is actually
being populated after mount_setup() and does not need relabelling as at
that moment the SELinux policy is already loaded. Since however the root
cgroup filesystem was remounted read-only in the meantime this operation
will now fail.

To fix this check for the filesystem mount flags before relabelling and
only remount ro->rw->ro if necessary and leave the filesystem read-write
otherwise.

Fixes #7901.
src/core/mount-setup.c