]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - kernel/bpf/verifier.c
bpf: Allow loading of a bpf_iter program
authorYonghong Song <yhs@fb.com>
Sat, 9 May 2020 17:59:00 +0000 (10:59 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 10 May 2020 00:05:26 +0000 (17:05 -0700)
commit15d83c4d7cef5c067a8b075ce59e97df4f60706e
treeb6baafd12655fe3a8d53f8db5d87fcfb95de4559
parentae24345da54e452880808b011fa2d8a0bbd191ba
bpf: Allow loading of a bpf_iter program

A bpf_iter program is a tracing program with attach type
BPF_TRACE_ITER. The load attribute
  attach_btf_id
is used by the verifier against a particular kernel function,
which represents a target, e.g., __bpf_iter__bpf_map
for target bpf_map which is implemented later.

The program return value must be 0 or 1 for now.
  0 : successful, except potential seq_file buffer overflow
      which is handled by seq_file reader.
  1 : request to restart the same object

In the future, other return values may be used for filtering or
teminating the iterator.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200509175900.2474947-1-yhs@fb.com
include/linux/bpf.h
include/uapi/linux/bpf.h
kernel/bpf/bpf_iter.c
kernel/bpf/verifier.c
tools/include/uapi/linux/bpf.h