Re: [PATCH net v2] net: Fix suspicious RCU usage in bpf_sk_reuseport_detach()

From: kernel test robot
Date: Wed Aug 17 2022 - 04:14:37 EST


Hi David,

I love your patch! Yet something to improve:

[auto build test ERROR on net/master]

url: https://github.com/intel-lab-lkp/linux/commits/David-Howells/net-Fix-suspicious-RCU-usage-in-bpf_sk_reuseport_detach/20220816-212744
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git ae806c7805571a9813e41bf6763dd08d0706f4ed
config: x86_64-rhel-8.3-kvm (https://download.01.org/0day-ci/archive/20220817/202208171521.JiKYmnhP-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/fe74fdc1e7fe8aa84006265deb7b55f40bcc8736
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review David-Howells/net-Fix-suspicious-RCU-usage-in-bpf_sk_reuseport_detach/20220816-212744
git checkout fe74fdc1e7fe8aa84006265deb7b55f40bcc8736
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: kernel/bpf/reuseport_array.o: in function `bpf_sk_reuseport_detach':
>> kernel/bpf/reuseport_array.c:28: undefined reference to `lockdep_is_held'


vim +28 kernel/bpf/reuseport_array.c

20
21 /* The caller must hold the reuseport_lock */
22 void bpf_sk_reuseport_detach(struct sock *sk)
23 {
24 struct sock __rcu **socks;
25
26 write_lock_bh(&sk->sk_callback_lock);
27 socks = __rcu_dereference_sk_user_data_with_flags_check(
> 28 sk, SK_USER_DATA_BPF, lockdep_is_held(&sk->sk_callback_lock));
29 if (socks) {
30 WRITE_ONCE(sk->sk_user_data, NULL);
31 /*
32 * Do not move this NULL assignment outside of
33 * sk->sk_callback_lock because there is
34 * a race with reuseport_array_free()
35 * which does not hold the reuseport_lock.
36 */
37 RCU_INIT_POINTER(*socks, NULL);
38 }
39 write_unlock_bh(&sk->sk_callback_lock);
40 }
41

--
0-DAY CI Kernel Test Service
https://01.org/lkp