core/bpf-firewall: make failures in loading custom BPF program not critical
All other resource control features work as 'best-effort', and failures
in applying them are handled gracefully. However, unlike the other features,
we tested if the BPF programs can be loaded and refuse execution on failure.
Moreover, the previous behavior of testing loading BPF programs had
inconsistency: the test was silently skipped if the cgroup for the unit does
not exist yet, but tested when the cgroup already exists.
Let's not handle failures in loading custom BPF programs as critical, but
gracefully ignore them, like we do for the other resource control features.
Follow-up for fab347489f.
This commit is contained in:
@@ -2204,12 +2204,6 @@ int unit_attach_pids_to_cgroup(Unit *u, Set *pids, const char *suffix_path) {
|
||||
if (set_isempty(pids))
|
||||
return 0;
|
||||
|
||||
/* Load any custom firewall BPF programs here once to test if they are existing and actually loadable.
|
||||
* Fail here early since later errors in the call chain unit_realize_cgroup to cgroup_context_apply are ignored. */
|
||||
r = bpf_firewall_load_custom(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
r = unit_realize_cgroup(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
@@ -6005,12 +6005,6 @@ int unit_prepare_exec(Unit *u) {
|
||||
|
||||
assert(u);
|
||||
|
||||
/* Load any custom firewall BPF programs here once to test if they are existing and actually loadable.
|
||||
* Fail here early since later errors in the call chain unit_realize_cgroup to cgroup_context_apply are ignored. */
|
||||
r = bpf_firewall_load_custom(u);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Prepares everything so that we can fork of a process for this unit */
|
||||
|
||||
r = unit_realize_cgroup(u);
|
||||
|
||||
Reference in New Issue
Block a user