selinux: reload label db on policy load with libselinux 3.2
authorChristian Göttsche <cgzones@googlemail.com>
Fri, 14 May 2021 12:12:39 +0000 (14:12 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 9 Jul 2021 15:05:46 +0000 (17:05 +0200)
commit82e9abf69ada90373efd7dc2db9934510562b853
treeedbe0f32cd7b1351875ee212f3edd504ed5502c2
parent2092f33c9f7f1daa9424e7233ed2b3fab06c9e6e
selinux: reload label db on policy load with libselinux 3.2

Currently the label database is not reloaded with libselinux 3.2 on a
policy reload.

Since libselinux 3.2 avc_open(3) uses the SELinux status page instead of
a netlink socket to check for policy reloads.
The status page is also queried in mac_selinux_maybe_reload().
Thus calls to selinux_check_access(3) might consume an update, queried
by selinux_status_updated(3), leaving mac_selinux_maybe_reload() unable
to detect a policy reload.

Do not use selinux_status_updated(3), use selinux_status_policyload(3)
unconditionally.

Relevant libselinux commit: https://github.com/SELinuxProject/selinux/commit/05bdc03130d741e53e1fb45a958d0a2c184be503

Debian Bullseye is going to ship libselinux 3.1, so stay compatible for
backports.

(cherry picked from commit c46c76881144271b9a18842e086d1318febdb372)
src/basic/selinux-util.c