]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: permit CGROUP_DEVICE programs accessing helper bpf_get_current_cgroup_id()
authorYonghong Song <yhs@fb.com>
Thu, 27 Sep 2018 21:37:30 +0000 (14:37 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 28 Sep 2018 12:15:19 +0000 (14:15 +0200)
commit2c6a25483efc331fe3d69d78bd84e68ac7b438eb
tree97159aaae6aa1e3502737f33f7f2d0e42b4239b2
parentf3dfe7d2762549bf25d5113af45552197d1a405d
bpf: permit CGROUP_DEVICE programs accessing helper bpf_get_current_cgroup_id()

Currently, helper bpf_get_current_cgroup_id() is not permitted
for CGROUP_DEVICE type of programs. If the helper is used
in such cases, the verifier will log the following error:

  0: (bf) r6 = r1
  1: (69) r7 = *(u16 *)(r6 +0)
  2: (85) call bpf_get_current_cgroup_id#80
  unknown func bpf_get_current_cgroup_id#80

The bpf_get_current_cgroup_id() is useful for CGROUP_DEVICE
type of programs in order to customize action based on cgroup id.
This patch added such a support.

Cc: Roman Gushchin <guro@fb.com>
Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/bpf/cgroup.c