]> git.baikalelectronics.ru Git - kernel.git/commit
libbpf: Fix detection of BPF helper call instruction
authorAndrii Nakryiko <andriin@fb.com>
Thu, 20 Aug 2020 06:14:08 +0000 (23:14 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 20 Aug 2020 14:45:09 +0000 (16:45 +0200)
commit10456787aa7330a3dcce38b871ea64f06ea17e1a
treeafc42c68923d9e671ccd9384ef1a0d52ecbf2d2b
parent2b56414774c62f4225c58cdb71c7836168aaf355
libbpf: Fix detection of BPF helper call instruction

BPF_CALL | BPF_JMP32 is explicitly not allowed by verifier for BPF helper
calls, so don't detect it as a valid call. Also drop the check on func_id
pointer, as it's currently always non-null.

Fixes: 49200de9cd93 ("libbpf: Sanitize BPF program code for bpf_probe_read_{kernel, user}[_str]")
Reported-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20200820061411.1755905-1-andriin@fb.com
tools/lib/bpf/libbpf.c