bpf: cgroup: properly use bpf_prog_array api
authorStanislav Fomichev <sdf@google.com>
Tue, 28 May 2019 21:14:43 +0000 (14:14 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 29 May 2019 13:17:35 +0000 (15:17 +0200)
commitdbcc1ba26e43bd32cb308e50ac4cb4a29d2f5967
tree1d8ce96e66911655a7abeafbddb7fb39b777a175
parent02205d2ed6fe26a8f4fd9e9cec251d1dc7f79316
bpf: cgroup: properly use bpf_prog_array api

Now that we don't have __rcu markers on the bpf_prog_array helpers,
let's use proper rcu_dereference_protected to obtain array pointer
under mutex.

We also don't need __rcu annotations on cgroup_bpf.inactive since
it's not read/updated concurrently.

v4:
* drop cgroup_rcu_xyz wrappers and use rcu APIs directly; presumably
  should be more clear to understand which mutex/refcount protects
  each particular place

v3:
* amend cgroup_rcu_dereference to include percpu_ref_is_dying;
  cgroup_bpf is now reference counted and we don't hold cgroup_mutex
  anymore in cgroup_bpf_release

v2:
* replace xchg with rcu_swap_protected

Cc: Roman Gushchin <guro@fb.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Acked-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/linux/bpf-cgroup.h
kernel/bpf/cgroup.c