]> git.baikalelectronics.ru Git - kernel.git/commit
bpf/test_run: fix unkillable BPF_PROG_TEST_RUN for flow dissector
authorStanislav Fomichev <sdf@google.com>
Tue, 19 Feb 2019 18:54:17 +0000 (10:54 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Mon, 25 Feb 2019 21:21:22 +0000 (22:21 +0100)
commit6795a6b83c82d0e3add0e81d5efa32ce6e8fbb0a
treea5e9805e70b42c76bb3ce9f7a79a77f1c22d163a
parent5f4c8e414df5326bc91f8ed05e95f744dbd3ef21
bpf/test_run: fix unkillable BPF_PROG_TEST_RUN for flow dissector

Syzbot found out that running BPF_PROG_TEST_RUN with repeat=0xffffffff
makes process unkillable. The problem is that when CONFIG_PREEMPT is
enabled, we never see need_resched() return true. This is due to the
fact that preempt_enable() (which we do in bpf_test_run_one on each
iteration) now handles resched if it's needed.

Let's disable preemption for the whole run, not per test. In this case
we can properly see whether resched is needed.
Let's also properly return -EINTR to the userspace in case of a signal
interrupt.

This is a follow up for a recently fixed issue in bpf_test_run, see
commit a35d8218d611 ("bpf/test_run: fix unkillable
BPF_PROG_TEST_RUN").

Reported-by: syzbot <syzkaller@googlegroups.com>
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
net/bpf/test_run.c