]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix bpf_attr.attach_btf_id check
authorAlexei Starovoitov <ast@kernel.org>
Fri, 18 Oct 2019 06:09:33 +0000 (23:09 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 18 Oct 2019 18:55:54 +0000 (20:55 +0200)
commitea1b7d8e1746fdb058c641328eb576bd0fbf37bc
tree726b10886246a205b1bf14d0d5b87f8d7b2b971c
parent90df1c10ab12f9070a9f3b7838b0c058cb950657
bpf: Fix bpf_attr.attach_btf_id check

Only raw_tracepoint program type can have bpf_attr.attach_btf_id >= 0.
Make sure to reject other program types that accidentally set it to non-zero.

Fixes: 341189855e86 ("bpf: Add attach_btf_id attribute to program load")
Reported-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20191018060933.2950231-1-ast@kernel.org
kernel/bpf/syscall.c