]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: guard bpf_get_current_cgroup_id() with CONFIG_CGROUPS
authorYonghong Song <yhs@fb.com>
Mon, 4 Jun 2018 15:53:41 +0000 (08:53 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 4 Jun 2018 19:52:26 +0000 (21:52 +0200)
commita85c5e6a9831e6a458e1e17a1be8f6ca9039a766
tree82a6a5c2b288e9d1011c4a24e71825cce3b37792
parentd7898cb84d6d3c47899cdcd1806f4a0d7c8c30a0
bpf: guard bpf_get_current_cgroup_id() with CONFIG_CGROUPS

Commit 79b4b290b6dd ("bpf: implement bpf_get_current_cgroup_id()
helper") introduced a new helper bpf_get_current_cgroup_id().
The helper has a dependency on CONFIG_CGROUPS.

When CONFIG_CGROUPS is not defined, using the helper will result
the following verifier error:
  kernel subsystem misconfigured func bpf_get_current_cgroup_id#80
which is hard for users to interpret.
Guarding the reference to bpf_get_current_cgroup_id_proto with
CONFIG_CGROUPS will result in below better message:
  unknown func bpf_get_current_cgroup_id#80

Fixes: 79b4b290b6dd ("bpf: implement bpf_get_current_cgroup_id() helper")
Suggested-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
kernel/trace/bpf_trace.c