]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: refuse PrivatePIDs= + PAMName=
authorMike Yuan <me@yhndnzj.com>
Fri, 6 Mar 2026 18:22:44 +0000 (19:22 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Sat, 13 Jun 2026 15:11:11 +0000 (17:11 +0200)
Fixes #40928

src/core/unit.c

index 35691363e06152f0004fb14c0adafe01be634512..2205ad0e2bc63ae996622bea20dd3b5eff9c6e72 100644 (file)
@@ -4345,10 +4345,13 @@ static int unit_verify_contexts(const Unit *u) {
                 return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "PrivatePIDs= setting is only supported for service units. Refusing.");
 
         if ((ec->user || ec->dynamic_user || ec->group || ec->pam_name) && ec->private_users == PRIVATE_USERS_MANAGED)
-                return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "PrivateUsers=managed may not be used in combination with User=/DynamicUser=/Group=/PAMName=, refusing.");
+                return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "PrivateUsers=managed may not be used in combination with User=/DynamicUser=/Group=/PAMName=. Refusing.");
 
         if (ec->user_namespace_path && ec->private_users != PRIVATE_USERS_NO)
-                return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "PrivateUsers= may not be used with custom UserNamespacePath=, refusing.");
+                return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "PrivateUsers= may not be used with custom UserNamespacePath=. Refusing.");
+
+        if (ec->private_pids != PRIVATE_PIDS_NO && ec->pam_name)
+                return log_unit_error_errno(u, SYNTHETIC_ERRNO(ENOEXEC), "PAM is not supported under PrivatePIDs=. Refusing.");
 
         const KillContext *kc = unit_get_kill_context(u);