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
See recent discussion:
I'll follow up with the same fix bpf_prog_test_run_flow_dissector in
Reported-by: syzbot <firstname.lastname@example.org>
Signed-off-by: Stanislav Fomichev <email@example.com>
Signed-off-by: Daniel Borkmann <firstname.lastname@example.org>