From: Yu Watanabe Date: Tue, 8 Apr 2025 08:37:11 +0000 (+0900) Subject: core/bpf-foreign: drop unnecessary check for cgroup v1 X-Git-Tag: v258-rc1~812^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fcb98cbff0a5be8bf7c5deda6c1f7e8a31699bd;p=thirdparty%2Fsystemd.git core/bpf-foreign: drop unnecessary check for cgroup v1 --- diff --git a/src/core/bpf-foreign.h b/src/core/bpf-foreign.h index e387b1b1d38..c97be7c72f4 100644 --- a/src/core/bpf-foreign.h +++ b/src/core/bpf-foreign.h @@ -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. diff --git a/src/core/cgroup.c b/src/core/cgroup.c index 566054be837..6aa9f1fc3e7 100644 --- a/src/core/cgroup.c +++ b/src/core/cgroup.c @@ -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(); diff --git a/src/core/dbus-cgroup.c b/src/core/dbus-cgroup.c index 2be7dfaa295..882c916c102 100644 --- a/src/core/dbus-cgroup.c +++ b/src/core/dbus-cgroup.c @@ -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;