The parent process may not perform any label operation, so the
database might not get updated on a SELinux policy change on its own.
Reload the label database once on a policy change, instead of n times
in every started child.
if (!line)
return log_oom();
+ /* fork with up-to-date SELinux label database, so the child inherits the up-to-date db
+ and, until the next SELinux policy changes, we safe further reloads in future children */
+ mac_selinux_maybe_reload();
+
log_struct(LOG_DEBUG,
LOG_UNIT_MESSAGE(unit, "About to execute: %s", line),
"EXECUTABLE=%s", command->path,
/* Re-enable the debug message for the next batch of events */
log_children_max_reached = true;
+ /* fork with up-to-date SELinux label database, so the child inherits the up-to-date db
+ and, until the next SELinux policy changes, we safe further reloads in future children */
+ mac_selinux_maybe_reload();
+
/* start new worker and pass initial device */
worker_spawn(manager, event);
}