Re: net: suspicious RCU usage in nf_hook

From: Cong Wang
Date: Fri Jan 27 2017 - 18:31:25 EST


On Fri, Jan 27, 2017 at 3:22 PM, Cong Wang <xiyou.wangcong@xxxxxxxxx> wrote:
> On Fri, Jan 27, 2017 at 1:15 PM, Dmitry Vyukov <dvyukov@xxxxxxxxxx> wrote:
>> stack backtrace:
>> CPU: 2 PID: 23111 Comm: syz-executor14 Not tainted 4.10.0-rc5+ #192
>> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
>> Call Trace:
>> __dump_stack lib/dump_stack.c:15 [inline]
>> dump_stack+0x2ee/0x3ef lib/dump_stack.c:51
>> lockdep_rcu_suspicious+0x139/0x180 kernel/locking/lockdep.c:4452
>> rcu_preempt_sleep_check include/linux/rcupdate.h:560 [inline]
>> ___might_sleep+0x560/0x650 kernel/sched/core.c:7748
>> __might_sleep+0x95/0x1a0 kernel/sched/core.c:7739
>> mutex_lock_nested+0x24f/0x1730 kernel/locking/mutex.c:752
>> atomic_dec_and_mutex_lock+0x119/0x160 kernel/locking/mutex.c:1060
>> __static_key_slow_dec+0x7a/0x1e0 kernel/jump_label.c:149
>> static_key_slow_dec+0x51/0x90 kernel/jump_label.c:174
>> net_disable_timestamp+0x3b/0x50 net/core/dev.c:1728
>> sock_disable_timestamp+0x98/0xc0 net/core/sock.c:403
>> __sk_destruct+0x27d/0x6b0 net/core/sock.c:1441
>> sk_destruct+0x47/0x80 net/core/sock.c:1460
>
> jump label uses a mutex and we call jump label API in softIRQ context...
> Maybe we have to move it to a work struct as what we did for netlink.

Correct myself: process context but with RCU read lock held...