]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix check_return_code to only allow [0,1] in trace_iter progs
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 May 2020 22:39:18 +0000 (00:39 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 15 May 2020 22:48:02 +0000 (00:48 +0200)
commite6d1404b7f383ee511f1f2ef6835584dcbdce56a
treebdbfd9b5b041a9dfef6345cd072a25f2d9a421a7
parenta3d9097f5be8a30021c12002572c637f1adb64b7
bpf: Fix check_return_code to only allow [0,1] in trace_iter progs

As per d224c790ffd6 ("bpf: Allow loading of a bpf_iter program") we only
allow a range of [0,1] for return codes. Therefore BPF_TRACE_ITER relies
on the default tnum_range(0, 1) which is set in range var. On recent merge
of net into net-next commit cd440edfd5fc ("bpf: Enforce returning 0 for
fentry/fexit progs") got pulled in and caused a merge conflict with the
changes from d224c790ffd6. The resolution had a snall hiccup in that it
removed the [0,1] range restriction again so that BPF_TRACE_ITER would
have no enforcement. Fix it by adding it back.

Fixes: a3d9097f5be8 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c