bpf: Don't check for recursion in bpf_wq_work.
authorAlexei Starovoitov <ast@kernel.org>
Wed, 24 Apr 2024 16:00:23 +0000 (09:00 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 24 Apr 2024 16:06:50 +0000 (09:06 -0700)
commitdc92febf7b93da5049fe177804e6b1961fcc6bd7
treecd49ada6055ba7c3933b03d82998efb303ec19a1
parent6e10b6350a67d398c795ac0b93a7bb7103633fe4
bpf: Don't check for recursion in bpf_wq_work.

__bpf_prog_enter_sleepable_recur does recursion check which is not applicable
to wq callback. The callback function is part of bpf program and bpf prog might
be running on the same cpu. So recursion check would incorrectly prevent
callback from running. The code can call __bpf_prog_enter_sleepable(), but
run_ctx would be fake, hence use explicit rcu_read_lock_trace();
migrate_disable(); to address this problem. Another reason to open code is
__bpf_prog_enter* are not available in !JIT configs.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202404241719.IIGdpAku-lkp@intel.com/
Closes: https://lore.kernel.org/oe-kbuild-all/202404241811.FFV4Bku3-lkp@intel.com/
Fixes: eb48f6cd41a0 ("bpf: wq: add bpf_wq_init")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/helpers.c