]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Compare BTF types of functions arguments with actual types
authorAlexei Starovoitov <ast@kernel.org>
Thu, 14 Nov 2019 18:57:16 +0000 (10:57 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 Nov 2019 22:45:02 +0000 (23:45 +0100)
commitc1d97dc5ef0d161453dc8b03be1cadec183ecada
treeb1fcd11bc9e7da8474a587e037c7f32df992b0b1
parent7164f3c0eb0a86e5a9c03838798572b4fe4ccef0
bpf: Compare BTF types of functions arguments with actual types

Make the verifier check that BTF types of function arguments match actual types
passed into top-level BPF program and into BPF-to-BPF calls. If types match
such BPF programs and sub-programs will have full support of BPF trampoline. If
types mismatch the trampoline has to be conservative. It has to save/restore
five program arguments and assume 64-bit scalars.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Song Liu <songliubraving@fb.com>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20191114185720.1641606-17-ast@kernel.org
include/linux/bpf.h
include/linux/bpf_verifier.h
kernel/bpf/btf.c
kernel/bpf/syscall.c
kernel/bpf/verifier.c