From: Christian Göttsche Date: Sat, 5 Sep 2020 15:49:48 +0000 (+0200) Subject: selinux: early exit in mac_selinux_maybe_reload if not initialized X-Git-Tag: v247-rc1~290 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1006038cf103f11ce50fe27ae8f7ee2a3badb05b;p=thirdparty%2Fsystemd.git selinux: early exit in mac_selinux_maybe_reload if not initialized Binaries might not initialize SELinux, e.g. when they normally do not create files with the SELinux default context. If they, via an internal libary function, call a _label() function, mac_selinux_maybe_reload() gets called. Since the SELinux status page has not been opened, selinux_status_updated() will fail with EINVAL. This affects particularly test binaries. Just exit early and avoid confusing debug logs. --- diff --git a/src/basic/selinux-util.c b/src/basic/selinux-util.c index 2876b718bf8..9b3b15d387d 100644 --- a/src/basic/selinux-util.c +++ b/src/basic/selinux-util.c @@ -153,6 +153,9 @@ void mac_selinux_maybe_reload(void) { #if HAVE_SELINUX int r; + if (!initialized) + return; + r = selinux_status_updated(); if (r < 0) log_debug_errno(errno, "Failed to update SELinux from status page: %m");