From a53d9a5794d5bed32d0901f0223cc2f737d151e3 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Tue, 17 Feb 2026 09:26:20 +0100 Subject: [PATCH 1/5] namespace-util: add missing half of the assertion in is_our_namespace() --- src/basic/namespace-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/namespace-util.c b/src/basic/namespace-util.c index fff518ef96..97ed3d268f 100644 --- a/src/basic/namespace-util.c +++ b/src/basic/namespace-util.c @@ -359,7 +359,7 @@ int is_our_namespace(int fd, NamespaceType type) { int r; assert(fd >= 0); - assert(type < _NAMESPACE_TYPE_MAX); + assert(type >= 0 && type < _NAMESPACE_TYPE_MAX); r = fd_is_namespace(fd, type); if (r < 0) From 9be5a6f665db956026a165af691da1f57319f6a1 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Wed, 21 Jan 2026 19:58:41 +0100 Subject: [PATCH 2/5] core/manager: add missing assertion on stop_notify_queue being empty Follow-up for 1b4ab5a209c4874e01cf9577c740b82567458b09 --- src/core/manager.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/core/manager.c b/src/core/manager.c index bb8a735683..971f01903c 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1679,6 +1679,7 @@ static void manager_clear_jobs_and_units(Manager *m) { assert(!m->start_when_upheld_queue); assert(!m->stop_when_bound_queue); assert(!m->release_resources_queue); + assert(!m->stop_notify_queue); assert(hashmap_isempty(m->jobs)); assert(hashmap_isempty(m->units)); From 6f0731cf34e110a7d964367f42ec16f720ebf486 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Fri, 6 Mar 2026 19:22:44 +0100 Subject: [PATCH 3/5] core/unit: refuse PrivatePIDs= + PAMName= Fixes #40928 --- src/core/unit.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 35691363e0..2205ad0e2b 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -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); From cd13dc16c3651678a541289dc51c4a4e5131f405 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 7 Mar 2026 05:53:14 +0100 Subject: [PATCH 4/5] core/execute-serialize: fix error handling --- src/core/execute-serialize.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/execute-serialize.c b/src/core/execute-serialize.c index 953b0d9894..55a5216042 100644 --- a/src/core/execute-serialize.c +++ b/src/core/execute-serialize.c @@ -3278,7 +3278,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) { r = extract_first_word(&val, &options, NULL, EXTRACT_UNQUOTE); if (r < 0) - return -r; + return r; if (isempty(options) || streq(options, "rbind")) rbind = true; @@ -3337,7 +3337,7 @@ static int exec_context_deserialize(ExecContext *c, FILE *f) { r = extract_first_word(&val, &options, NULL, EXTRACT_UNQUOTE); if (r < 0) - return -r; + return r; if (isempty(options) || streq(options, "rbind")) rbind = true; From a9e5f5116e61027e533b853c23223a9b56599b1f Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Sat, 7 Mar 2026 05:37:30 +0100 Subject: [PATCH 5/5] sd-daemon: escape notification msg using shell_escape() Follow-up for f9e0a62392fa62364bb7ac31a1cd4a8cc521cced xescape() would unconditionally emit hex escapes, rendering \n unreadable. --- src/libsystemd/sd-daemon/sd-daemon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsystemd/sd-daemon/sd-daemon.c b/src/libsystemd/sd-daemon/sd-daemon.c index da5242c3b7..50bdcb1a23 100644 --- a/src/libsystemd/sd-daemon/sd-daemon.c +++ b/src/libsystemd/sd-daemon/sd-daemon.c @@ -637,8 +637,8 @@ static int pid_notify_with_fds_internal( } if (DEBUG_LOGGING) { - _cleanup_free_ char *escaped = xescape_full(state, "\"", /* console_width = */ SIZE_MAX, XESCAPE_8_BIT); - log_debug("Notify message sent to '%s': \"%s\"", e, escaped ?: state); + _cleanup_free_ char *escaped = shell_escape(state, "\""); + log_debug("Notify message sent to '%s': \"%s\"", e, strnull(escaped)); } return 1;