execute: always log a warning when setting SELinux context fails
Update also manual page to explain how the transition can still fail.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
b01ee585c9
commit
006d1864fb
+12
-6
@@ -4579,9 +4579,12 @@ static int exec_child(
|
||||
|
||||
if (fd >= 0) {
|
||||
r = mac_selinux_get_child_mls_label(fd, executable, context->selinux_context, &mac_selinux_context_net);
|
||||
if (r < 0 && !context->selinux_context_ignore) {
|
||||
*exit_status = EXIT_SELINUX_CONTEXT;
|
||||
return log_unit_error_errno(unit, r, "Failed to determine SELinux context: %m");
|
||||
if (r < 0) {
|
||||
if (!context->selinux_context_ignore) {
|
||||
*exit_status = EXIT_SELINUX_CONTEXT;
|
||||
return log_unit_error_errno(unit, r, "Failed to determine SELinux context: %m");
|
||||
}
|
||||
log_unit_debug_errno(unit, r, "Failed to determine SELinux context, ignoring: %m");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4713,9 +4716,12 @@ static int exec_child(
|
||||
|
||||
if (exec_context) {
|
||||
r = setexeccon(exec_context);
|
||||
if (r < 0 && !context->selinux_context_ignore) {
|
||||
*exit_status = EXIT_SELINUX_CONTEXT;
|
||||
return log_unit_error_errno(unit, r, "Failed to change SELinux context to %s: %m", exec_context);
|
||||
if (r < 0) {
|
||||
if (!context->selinux_context_ignore) {
|
||||
*exit_status = EXIT_SELINUX_CONTEXT;
|
||||
return log_unit_error_errno(unit, r, "Failed to change SELinux context to %s: %m", exec_context);
|
||||
}
|
||||
log_unit_debug_errno(unit, r, "Failed to change SELinux context to %s, ignoring: %m", exec_context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user