Eric Dumazet
e64e469b9a
ipv6: addrconf: break critical section in addrconf_verify_rtnl()
Heiner reported a lockdep splat [1]
This is caused by attempting GFP_KERNEL allocation while RCU lock is
held and BH blocked.
We believe that addrconf_verify_rtnl() could run for a long period,
so instead of using GFP_ATOMIC here as Ido suggested, we should break
the critical section and restart it after the allocation.
[1]
[86220.125562] =============================
[86220.125586] WARNING: suspicious RCU usage
[86220.125612] 4.15.0-rc7-next-20180110+ #7 Not tainted
[86220.125641] -----------------------------
[86220.125666] kernel/sched/core.c:6026 Illegal context switch in RCU-bh read-side critical section!
[86220.125711]
other info that might help us debug this:
[86220.125755]
rcu_scheduler_active = 2, debug_locks = 1
[86220.125792] 4 locks held by kworker/0:2/1003:
[86220.125817] #0: ((wq_completion)"%s"("ipv6_addrconf")){+.+.}, at: [<00000000da8e9b73>] process_one_work+0x1de/0x680
[86220.125895] #1: ((addr_chk_work).work){+.+.}, at: [<00000000da8e9b73>] process_one_work+0x1de/0x680
[86220.125959] #2: (rtnl_mutex){+.+.}, at: [<00000000b06d9510>] rtnl_lock+0x12/0x20
[86220.126017] #3: (rcu_read_lock_bh){....}, at: [<00000000aef52299>] addrconf_verify_rtnl+0x1e/0x510 [ipv6]
[86220.126111]
stack backtrace:
[86220.126142] CPU: 0 PID: 1003 Comm: kworker/0:2 Not tainted 4.15.0-rc7-next-20180110+ #7
[86220.126185] Hardware name: ZOTAC ZBOX-CI321NANO/ZBOX-CI321NANO, BIOS B246P105 06/01/2015
[86220.126250] Workqueue: ipv6_addrconf addrconf_verify_work [ipv6]
[86220.126288] Call Trace:
[86220.126312] dump_stack+0x70/0x9e
[86220.126337] lockdep_rcu_suspicious+0xce/0xf0
[86220.126365] ___might_sleep+0x1d3/0x240
[86220.126390] __might_sleep+0x45/0x80
[86220.126416] kmem_cache_alloc_trace+0x53/0x250
[86220.126458] ? ipv6_add_addr+0xfe/0x6e0 [ipv6]
[86220.126498] ipv6_add_addr+0xfe/0x6e0 [ipv6]
[86220.126538] ipv6_create_tempaddr+0x24d/0x430 [ipv6]
[86220.126580] ? ipv6_create_tempaddr+0x24d/0x430 [ipv6]
[86220.126623] addrconf_verify_rtnl+0x339/0x510 [ipv6]
[86220.126664] ? addrconf_verify_rtnl+0x339/0x510 [ipv6]
[86220.126708] addrconf_verify_work+0xe/0x20 [ipv6]
[86220.126738] process_one_work+0x258/0x680
[86220.126765] worker_thread+0x35/0x3f0
[86220.126790] kthread+0x124/0x140
[86220.126813] ? process_one_work+0x680/0x680
[86220.126839] ? kthread_create_worker_on_cpu+0x40/0x40
[86220.126869] ? umh_complete+0x40/0x40
[86220.126893] ? call_usermodehelper_exec_async+0x12a/0x160
[86220.126926] ret_from_fork+0x4b/0x60
[86220.126999] BUG: sleeping function called from invalid context at mm/slab.h:420
[86220.127041] in_atomic(): 1, irqs_disabled(): 0, pid: 1003, name: kworker/0:2
[86220.127082] 4 locks held by kworker/0:2/1003:
[86220.127107] #0: ((wq_completion)"%s"("ipv6_addrconf")){+.+.}, at: [<00000000da8e9b73>] process_one_work+0x1de/0x680
[86220.127179] #1: ((addr_chk_work).work){+.+.}, at: [<00000000da8e9b73>] process_one_work+0x1de/0x680
[86220.127242] #2: (rtnl_mutex){+.+.}, at: [<00000000b06d9510>] rtnl_lock+0x12/0x20
[86220.127300] #3: (rcu_read_lock_bh){....}, at: [<00000000aef52299>] addrconf_verify_rtnl+0x1e/0x510 [ipv6]
[86220.127414] CPU: 0 PID: 1003 Comm: kworker/0:2 Not tainted 4.15.0-rc7-next-20180110+ #7
[86220.127463] Hardware name: ZOTAC ZBOX-CI321NANO/ZBOX-CI321NANO, BIOS B246P105 06/01/2015
[86220.127528] Workqueue: ipv6_addrconf addrconf_verify_work [ipv6]
[86220.127568] Call Trace:
[86220.127591] dump_stack+0x70/0x9e
[86220.127616] ___might_sleep+0x14d/0x240
[86220.127644] __might_sleep+0x45/0x80
[86220.127672] kmem_cache_alloc_trace+0x53/0x250
[86220.127717] ? ipv6_add_addr+0xfe/0x6e0 [ipv6]
[86220.127762] ipv6_add_addr+0xfe/0x6e0 [ipv6]
[86220.127807] ipv6_create_tempaddr+0x24d/0x430 [ipv6]
[86220.127854] ? ipv6_create_tempaddr+0x24d/0x430 [ipv6]
[86220.127903] addrconf_verify_rtnl+0x339/0x510 [ipv6]
[86220.127950] ? addrconf_verify_rtnl+0x339/0x510 [ipv6]
[86220.127998] addrconf_verify_work+0xe/0x20 [ipv6]
[86220.128032] process_one_work+0x258/0x680
[86220.128063] worker_thread+0x35/0x3f0
[86220.128091] kthread+0x124/0x140
[86220.128117] ? process_one_work+0x680/0x680
[86220.128146] ? kthread_create_worker_on_cpu+0x40/0x40
[86220.128180] ? umh_complete+0x40/0x40
[86220.128207] ? call_usermodehelper_exec_async+0x12a/0x160
[86220.128243] ret_from_fork+0x4b/0x60
Fixes: f3d9832e56c4 ("ipv6: addrconf: cleanup locking in ipv6_add_addr")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-01-29 14:23:38 -05:00
..
2017-12-11 09:58:38 -05:00
2018-01-19 18:39:49 +01:00
2017-10-20 13:15:07 +01:00
2018-01-29 14:23:38 -05:00
2017-12-04 13:35:36 -05:00
2018-01-29 11:37:40 -05:00
2017-11-15 11:56:19 -08:00
2018-01-16 15:01:33 -05:00
2017-07-04 22:35:16 +01:00
2018-01-08 14:11:18 -05:00
2018-01-23 13:51:56 -05:00
2018-01-17 00:10:42 -05:00
2017-10-05 21:53:02 -07:00
2015-09-02 15:31:00 -07:00
2018-01-10 16:03:55 -05:00
2017-09-01 20:33:42 -07:00
2017-08-08 21:40:08 -07:00
2017-05-21 13:42:36 -04:00
2017-10-18 14:13:08 +01:00
2017-01-28 10:33:06 -05:00
2017-12-03 10:18:28 -05:00
2017-11-02 11:10:55 +01:00
2018-01-19 22:59:33 -05:00
2018-01-16 15:01:33 -05:00
2018-01-25 21:39:43 -05:00
2017-11-02 11:10:55 +01:00
2017-04-20 10:35:33 -04:00
2017-10-08 10:12:15 -07:00
2016-04-07 16:53:29 -04:00
2018-01-24 23:44:15 -05:00
2018-01-29 10:15:51 -05:00
2016-11-02 15:18:36 -04:00
2018-01-29 10:15:51 -05:00
2018-01-16 15:01:33 -05:00
2016-11-04 14:45:23 -04:00
2018-01-23 19:53:24 -05:00
2017-08-25 17:10:24 -07:00
2017-11-02 11:10:55 +01:00
2015-08-13 17:08:39 -07:00
2018-01-19 14:17:44 -05:00
2016-12-25 17:21:23 +01:00
2018-01-29 14:18:38 -05:00
2018-01-08 18:11:02 +01:00
2017-11-24 01:37:35 +09:00
2017-10-06 09:52:31 -07:00
2018-01-16 15:01:33 -05:00
2017-03-24 13:17:07 -07:00
2018-01-16 15:01:33 -05:00
2017-10-18 12:39:55 +01:00
2018-01-29 14:22:05 -05:00
2017-09-01 18:35:23 -07:00
2017-08-25 17:10:23 -07:00
2018-01-09 11:40:46 -05:00
2017-12-11 09:58:38 -05:00
2018-01-25 16:27:34 -05:00
2017-10-28 19:24:38 +09:00
2017-11-04 09:26:51 +09:00
2018-01-16 15:01:33 -05:00
2018-01-22 16:01:30 -05:00
2015-11-03 10:52:13 -05:00
2017-11-02 11:10:55 +01:00
2018-01-22 16:01:30 -05:00
2018-01-16 15:01:33 -05:00
2018-01-16 15:01:33 -05:00
2017-12-19 08:23:21 +01:00
2017-06-16 11:48:39 -04:00
2017-06-02 13:57:27 -04:00
2017-06-02 13:57:27 -04:00
2018-01-24 23:44:15 -05:00
2017-04-14 10:06:10 +02:00
2017-11-30 09:54:25 -05:00
2017-02-09 10:22:17 +01:00
2017-11-02 11:10:55 +01:00
2017-11-14 15:46:17 +09:00