]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/bpf-foreign: drop unnecessary check for cgroup v1
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 8 Apr 2025 08:37:11 +0000 (17:37 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 15 Apr 2025 18:56:04 +0000 (03:56 +0900)
src/core/bpf-foreign.h
src/core/cgroup.c
src/core/dbus-cgroup.c

index e387b1b1d3897a42ab065cf231685a393f6f0247..c97be7c72f44016327af632c220d147c6e994e54 100644 (file)
@@ -4,10 +4,6 @@
 
 #include "unit.h"
 
-static inline int bpf_foreign_supported(void) {
-        return cg_all_unified();
-}
-
 /*
  * Attach cgroup-bpf programs foreign to systemd, i.e. loaded to the kernel by an entity
  * external to systemd.
index 566054be8377391c85ea8f9c1c2325fe3aab7366..6aa9f1fc3e7fe01b6bfc30de1118b57112d0b06c 100644 (file)
@@ -3542,12 +3542,8 @@ static int cg_bpf_mask_supported(CGroupMask *ret) {
         if (r > 0)
                 mask |= CGROUP_MASK_BPF_DEVICES;
 
-        /* BPF pinned prog */
-        r = bpf_foreign_supported();
-        if (r < 0)
-                return r;
-        if (r > 0)
-                mask |= CGROUP_MASK_BPF_FOREIGN;
+        /* BPF pinned prog (always supported by cgroup v2) */
+        mask |= CGROUP_MASK_BPF_FOREIGN;
 
         /* BPF-based bind{4|6} hooks */
         r = bpf_socket_bind_supported();
index 2be7dfaa295a6d89f23c44bcdcf41f48bfc66cb3..882c916c1027d27073fce083d8d7c7bb2e85ec1e 100644 (file)
@@ -714,17 +714,6 @@ static int bus_cgroup_set_transient_property(
                                 return r;
 
                         unit_write_setting(u, flags, name, buf);
-
-                        if (c->bpf_foreign_programs) {
-                                r = bpf_foreign_supported();
-                                if (r < 0)
-                                        return r;
-                                if (r == 0)
-                                        log_full(LOG_DEBUG,
-                                                 "Transient unit %s configures a BPF program pinned to BPF "
-                                                 "filesystem, but the local system does not support that.\n"
-                                                 "Starting this unit will fail!", u->id);
-                        }
                 }
 
                 return 1;