TencentOS-kernel/kernel/cgroup
Andrii Nakryiko d1995b7ec0 bpf: Implement bpf_prog replacement for an active bpf_cgroup_link
[upstream commit 0c991ebc8c69d29b7fc44db17075c5aa5253e2ab]

Add new operation (LINK_UPDATE), which allows to replace active bpf_prog from
under given bpf_link. Currently this is only supported for bpf_cgroup_link,
but will be extended to other kinds of bpf_links in follow-up patches.

For bpf_cgroup_link, implemented functionality matches existing semantics for
direct bpf_prog attachment (including BPF_F_REPLACE flag). User can either
unconditionally set new bpf_prog regardless of which bpf_prog is currently
active under given bpf_link, or, optionally, can specify expected active
bpf_prog. If active bpf_prog doesn't match expected one, no changes are
performed, old bpf_link stays intact and attached, operation returns
a failure.

cgroup_bpf_replace() operation is resolving race between auto-detachment and
bpf_prog update in the same fashion as it's done for bpf_link detachment,
except in this case update has no way of succeeding because of target cgroup
marked as dying. So in this case error is returned.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200330030001.2312810-3-andriin@fb.com
2022-06-21 10:27:08 +08:00
..
Makefile sli: Introduce memory and sched latency stat infrastructure 2021-10-29 06:51:52 +00:00
cgroup-internal.h cgroup: add cgroup.id to show each css id within a cgroup 2022-06-21 10:27:04 +08:00
cgroup-v1.c cgroup: add cgroup.id to show each css id within a cgroup 2022-06-21 10:27:04 +08:00
cgroup.c bpf: Implement bpf_prog replacement for an active bpf_cgroup_link 2022-06-21 10:27:08 +08:00
cpuset.c cgroupfs: support stat based on cpuacct 2022-05-18 14:43:14 +08:00
debug.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
freezer.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
legacy_freezer.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
mbuf.c sli/cpu: introduce longsys check 2021-10-29 06:51:52 +00:00
namespace.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
pids.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
rdma.c Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces. 2021-03-16 11:01:34 +08:00
rstat.c Revert "cgroup: Add memory barriers to plug cgroup_rstat_updated() race window" 2021-03-16 16:28:43 +08:00
sli.c sli/kabi: add the kabi reserve space for sli structure 2022-04-18 21:10:23 +08:00