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)
commitc108e3c1bdbd0783d7c19ee80abb0591f79029e8
tree726b10886246a205b1bf14d0d5b87f8d7b2b971c
parent47a92ae074c3d166fa6476d1dfe581bc0356352e
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: ccfe29eb29c2 ("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