]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/mount-setup.c
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)
committerLennart Poettering <lennart@poettering.net>
Wed, 28 Mar 2018 11:36:33 +0000 (13:36 +0200)
commit6f7729c1767998110c4460c85c94435c5782a613
treecf322a3dd854dbebdae6fc65836c8f5ed57877f4
parent54479bf407e4d41d369e2cba0c8af04788a4c94b
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