]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/cgroup: drop trusted.survive_final_kill_signal fallback for kernel < 5.7
authorMike Yuan <me@yhndnzj.com>
Sun, 18 Jan 2026 21:40:30 +0000 (22:40 +0100)
committerMike Yuan <me@yhndnzj.com>
Mon, 19 Jan 2026 12:33:28 +0000 (13:33 +0100)
src/core/cgroup.c
src/shared/killall.c

index 9a218ff05862c2690403fb14e32e437aa2f3bfc1..c4336cd80ecaa51c797e3ac0ef7ec540693bfe73 100644 (file)
@@ -944,39 +944,12 @@ static void cgroup_delegate_xattr_apply(Unit *u) {
 }
 
 static void cgroup_survive_xattr_apply(Unit *u) {
-        int r;
-
         assert(u);
 
-        CGroupRuntime *crt = unit_get_cgroup_runtime(u);
-        if (!crt)
-                return;
-
-        if (u->survive_final_kill_signal) {
-                r = cg_set_xattr(
-                                crt->cgroup_path,
-                                "user.survive_final_kill_signal",
-                                "1",
-                                1,
-                                /* flags= */ 0);
-                /* user xattr support was added in kernel v5.7 */
-                if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
-                        r = cg_set_xattr(
-                                        crt->cgroup_path,
-                                        "trusted.survive_final_kill_signal",
-                                        "1",
-                                        1,
-                                        /* flags= */ 0);
-                if (r < 0)
-                        log_unit_debug_errno(u,
-                                             r,
-                                             "Failed to set 'survive_final_kill_signal' xattr on control "
-                                             "group %s, ignoring: %m",
-                                             empty_to_root(crt->cgroup_path));
-        } else {
+        if (u->survive_final_kill_signal)
+                unit_set_xattr_graceful(u, "user.survive_final_kill_signal", "1", 1);
+        else
                 unit_remove_xattr_graceful(u, "user.survive_final_kill_signal");
-                unit_remove_xattr_graceful(u, "trusted.survive_final_kill_signal");
-        }
 }
 
 static void cgroup_xattr_apply(Unit *u) {
index 729e0e248050542e4209198d4d2088300a3a04b3..d81f385634bcc696f477f7e8f667c5b6407df45d 100644 (file)
@@ -64,9 +64,6 @@ static bool is_in_survivor_cgroup(const PidRef *pid) {
         }
 
         r = cg_get_xattr_bool(cgroup_path, "user.survive_final_kill_signal");
-        /* user xattr support was added to kernel v5.7, try with the trusted namespace as a fallback */
-        if (ERRNO_IS_NEG_XATTR_ABSENT(r))
-                r = cg_get_xattr_bool(cgroup_path, "trusted.survive_final_kill_signal");
         if (r < 0 && !ERRNO_IS_NEG_XATTR_ABSENT(r))
                 log_debug_errno(r,
                                 "Failed to get survive_final_kill_signal xattr of %s, ignoring: %m",