syzbot


possible deadlock in __mod_timer

Status: upstream: reported on 2022/09/27 18:51
Reported-by: syzbot+622205cc61a6d1bb6452@syzkaller.appspotmail.com
First crash: 60d, last: 5d03h

Sample crash report:
chnl_net:caif_netlink_parms(): no params data found
======================================================
WARNING: possible circular locking dependency detected
6.1.0-rc6-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.2/3753 is trying to acquire lock:
ffffffff8c6c98e8 (zonelist_update_seq.seqcount){...-}-{0:0}, at: __alloc_pages+0x4aa/0x5b0 mm/page_alloc.c:5568

but task is already holding lock:
ffff88802c72a4d8 (&base->lock){-.-.}-{2:2}, at: __mod_timer+0x60c/0xe30 kernel/time/timer.c:1096

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #4 (&base->lock){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
       lock_timer_base+0x5a/0x1f0 kernel/time/timer.c:999
       __mod_timer+0x398/0xe30 kernel/time/timer.c:1072
       __queue_delayed_work+0x1a7/0x270 kernel/workqueue.c:1676
       queue_delayed_work_on+0x109/0x120 kernel/workqueue.c:1701
       psi_task_change+0x1bf/0x2f0 kernel/sched/psi.c:833
       psi_enqueue kernel/sched/stats.h:141 [inline]
       enqueue_task+0x1ec/0x3a0 kernel/sched/core.c:2056
       activate_task kernel/sched/core.c:2085 [inline]
       wake_up_new_task+0x632/0xdb0 kernel/sched/core.c:4706
       kernel_clone+0x229/0x980 kernel/fork.c:2702
       user_mode_thread+0xb1/0xf0 kernel/fork.c:2747
       rest_init+0x27/0x270 init/main.c:694
       arch_call_rest_init+0x13/0x1c init/main.c:890
       start_kernel+0x477/0x498 init/main.c:1145
       secondary_startup_64_no_verify+0xce/0xdb

-> #3 (&rq->__lock){-.-.}-{2:2}:
       _raw_spin_lock_nested+0x34/0x40 kernel/locking/spinlock.c:378
       raw_spin_rq_lock_nested+0x2f/0x120 kernel/sched/core.c:537
       raw_spin_rq_lock kernel/sched/sched.h:1354 [inline]
       rq_lock kernel/sched/sched.h:1644 [inline]
       task_fork_fair+0x6c/0x520 kernel/sched/fair.c:11608
       sched_cgroup_fork+0x3d1/0x540 kernel/sched/core.c:4650
       copy_process+0x4351/0x7190 kernel/fork.c:2370
       kernel_clone+0xeb/0x980 kernel/fork.c:2671
       user_mode_thread+0xb1/0xf0 kernel/fork.c:2747
       rest_init+0x27/0x270 init/main.c:694
       arch_call_rest_init+0x13/0x1c init/main.c:890
       start_kernel+0x477/0x498 init/main.c:1145
       secondary_startup_64_no_verify+0xce/0xdb

-> #2 (&p->pi_lock){-.-.}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
       try_to_wake_up+0xb2/0x20f0 kernel/sched/core.c:4076
       up+0x79/0xb0 kernel/locking/semaphore.c:191
       __up_console_sem+0xa4/0xc0 kernel/printk/printk.c:260
       __console_unlock kernel/printk/printk.c:2651 [inline]
       console_unlock+0x4ce/0x600 kernel/printk/printk.c:2862
       vga_remove_vgacon drivers/pci/vgaarb.c:189 [inline]
       vga_remove_vgacon.cold+0x99/0x9e drivers/pci/vgaarb.c:170
       virtio_gpu_pci_quirk drivers/gpu/drm/virtio/virtgpu_drv.c:60 [inline]
       virtio_gpu_probe.cold+0xe3/0x15d drivers/gpu/drm/virtio/virtgpu_drv.c:91
       virtio_dev_probe+0x57b/0x870 drivers/virtio/virtio.c:305
       call_driver_probe drivers/base/dd.c:560 [inline]
       really_probe+0x249/0xb90 drivers/base/dd.c:639
       __driver_probe_device+0x1df/0x4d0 drivers/base/dd.c:778
       driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:808
       __driver_attach+0x1d4/0x550 drivers/base/dd.c:1190
       bus_for_each_dev+0x14b/0x1d0 drivers/base/bus.c:301
       bus_add_driver+0x4cd/0x640 drivers/base/bus.c:618
       driver_register+0x224/0x3a0 drivers/base/driver.c:246
       do_one_initcall+0x141/0x780 init/main.c:1303
       do_initcall_level init/main.c:1376 [inline]
       do_initcalls init/main.c:1392 [inline]
       do_basic_setup init/main.c:1411 [inline]
       kernel_init_freeable+0x6ff/0x788 init/main.c:1631
       kernel_init+0x1e/0x1d0 init/main.c:1519
       ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306

-> #1 ((console_sem).lock){-...}-{2:2}:
       __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
       _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
       down_trylock+0x12/0x70 kernel/locking/semaphore.c:139
       __down_trylock_console_sem+0x40/0x120 kernel/printk/printk.c:243
       console_trylock kernel/printk/printk.c:2585 [inline]
       console_trylock_spinning kernel/printk/printk.c:1867 [inline]
       vprintk_emit+0x16b/0x600 kernel/printk/printk.c:2267
       vprintk+0x84/0xa0 kernel/printk/printk_safe.c:50
       _printk+0xbe/0xf1 kernel/printk/printk.c:2289
       build_zonelists+0x2e7/0x400 mm/page_alloc.c:6500
       __build_all_zonelists+0x122/0x180 mm/page_alloc.c:6616
       build_all_zonelists_init+0x35/0x12f mm/page_alloc.c:6641
       build_all_zonelists+0x123/0x140 mm/page_alloc.c:6674
       start_kernel+0xbd/0x498 init/main.c:967
       secondary_startup_64_no_verify+0xce/0xdb

-> #0 (zonelist_update_seq.seqcount){...-}-{0:0}:
       check_prev_add kernel/locking/lockdep.c:3097 [inline]
       check_prevs_add kernel/locking/lockdep.c:3216 [inline]
       validate_chain kernel/locking/lockdep.c:3831 [inline]
       __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
       lock_acquire kernel/locking/lockdep.c:5668 [inline]
       lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
       seqcount_lockdep_reader_access include/linux/seqlock.h:102 [inline]
       read_seqbegin include/linux/seqlock.h:836 [inline]
       zonelist_iter_begin mm/page_alloc.c:4727 [inline]
       __alloc_pages_slowpath.constprop.0+0x1ae/0x23d0 mm/page_alloc.c:5049
       __alloc_pages+0x4aa/0x5b0 mm/page_alloc.c:5568
       __alloc_pages_node include/linux/gfp.h:223 [inline]
       kmem_getpages mm/slab.c:1363 [inline]
       cache_grow_begin+0x75/0x360 mm/slab.c:2570
       cache_alloc_refill+0x27f/0x380 mm/slab.c:2943
       ____cache_alloc mm/slab.c:3019 [inline]
       ____cache_alloc mm/slab.c:3002 [inline]
       __do_cache_alloc mm/slab.c:3202 [inline]
       slab_alloc_node mm/slab.c:3250 [inline]
       slab_alloc mm/slab.c:3265 [inline]
       __kmem_cache_alloc_lru mm/slab.c:3442 [inline]
       kmem_cache_alloc+0x364/0x460 mm/slab.c:3461
       kmem_cache_zalloc include/linux/slab.h:679 [inline]
       fill_pool+0x264/0x5c0 lib/debugobjects.c:168
       __debug_object_init+0x7a/0xd10 lib/debugobjects.c:562
       debug_object_init lib/debugobjects.c:617 [inline]
       debug_object_activate+0x330/0x3e0 lib/debugobjects.c:703
       debug_timer_activate kernel/time/timer.c:782 [inline]
       __mod_timer+0x77d/0xe30 kernel/time/timer.c:1103
       __queue_delayed_work+0x1a7/0x270 kernel/workqueue.c:1676
       queue_delayed_work_on+0x109/0x120 kernel/workqueue.c:1701
       queue_delayed_work include/linux/workqueue.h:518 [inline]
       wg_ratelimiter_init+0x19c/0x2c0 drivers/net/wireguard/ratelimiter.c:191
       wg_newlink+0x470/0x8f0 drivers/net/wireguard/device.c:367
       rtnl_newlink_create net/core/rtnetlink.c:3364 [inline]
       __rtnl_newlink+0x1087/0x17e0 net/core/rtnetlink.c:3581
       rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3594
       rtnetlink_rcv_msg+0x43e/0xca0 net/core/rtnetlink.c:6091
       netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
       netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
       netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
       netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
       sock_sendmsg_nosec net/socket.c:714 [inline]
       sock_sendmsg+0xd3/0x120 net/socket.c:734
       __sys_sendto+0x23a/0x340 net/socket.c:2117
       __do_sys_sendto net/socket.c:2129 [inline]
       __se_sys_sendto net/socket.c:2125 [inline]
       __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125
       do_syscall_x64 arch/x86/entry/common.c:50 [inline]
       do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
       entry_SYSCALL_64_after_hwframe+0x63/0xcd

other info that might help us debug this:

Chain exists of:
  zonelist_update_seq.seqcount --> &rq->__lock --> &base->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&base->lock);
                               lock(&rq->__lock);
                               lock(&base->lock);
  lock(zonelist_update_seq.seqcount);

 *** DEADLOCK ***

3 locks held by syz-executor.2/3753:
 #0: ffffffff8dec6e68 (rtnl_mutex){+.+.}-{3:3}, at: rtnl_lock net/core/rtnetlink.c:74 [inline]
 #0: ffffffff8dec6e68 (rtnl_mutex){+.+.}-{3:3}, at: rtnetlink_rcv_msg+0x3e9/0xca0 net/core/rtnetlink.c:6088
 #1: ffffffff8d3d8768 (init_lock){+.+.}-{3:3}, at: wg_ratelimiter_init+0x1b/0x2c0 drivers/net/wireguard/ratelimiter.c:160
 #2: ffff88802c72a4d8 (&base->lock){-.-.}-{2:2}, at: __mod_timer+0x60c/0xe30 kernel/time/timer.c:1096

stack backtrace:
CPU: 1 PID: 3753 Comm: syz-executor.2 Not tainted 6.1.0-rc6-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 check_noncircular+0x25f/0x2e0 kernel/locking/lockdep.c:2177
 check_prev_add kernel/locking/lockdep.c:3097 [inline]
 check_prevs_add kernel/locking/lockdep.c:3216 [inline]
 validate_chain kernel/locking/lockdep.c:3831 [inline]
 __lock_acquire+0x2a43/0x56d0 kernel/locking/lockdep.c:5055
 lock_acquire kernel/locking/lockdep.c:5668 [inline]
 lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
 seqcount_lockdep_reader_access include/linux/seqlock.h:102 [inline]
 read_seqbegin include/linux/seqlock.h:836 [inline]
 zonelist_iter_begin mm/page_alloc.c:4727 [inline]
 __alloc_pages_slowpath.constprop.0+0x1ae/0x23d0 mm/page_alloc.c:5049
 __alloc_pages+0x4aa/0x5b0 mm/page_alloc.c:5568
 __alloc_pages_node include/linux/gfp.h:223 [inline]
 kmem_getpages mm/slab.c:1363 [inline]
 cache_grow_begin+0x75/0x360 mm/slab.c:2570
 cache_alloc_refill+0x27f/0x380 mm/slab.c:2943
 ____cache_alloc mm/slab.c:3019 [inline]
 ____cache_alloc mm/slab.c:3002 [inline]
 __do_cache_alloc mm/slab.c:3202 [inline]
 slab_alloc_node mm/slab.c:3250 [inline]
 slab_alloc mm/slab.c:3265 [inline]
 __kmem_cache_alloc_lru mm/slab.c:3442 [inline]
 kmem_cache_alloc+0x364/0x460 mm/slab.c:3461
 kmem_cache_zalloc include/linux/slab.h:679 [inline]
 fill_pool+0x264/0x5c0 lib/debugobjects.c:168
 __debug_object_init+0x7a/0xd10 lib/debugobjects.c:562
 debug_object_init lib/debugobjects.c:617 [inline]
 debug_object_activate+0x330/0x3e0 lib/debugobjects.c:703
 debug_timer_activate kernel/time/timer.c:782 [inline]
 __mod_timer+0x77d/0xe30 kernel/time/timer.c:1103
 __queue_delayed_work+0x1a7/0x270 kernel/workqueue.c:1676
 queue_delayed_work_on+0x109/0x120 kernel/workqueue.c:1701
 queue_delayed_work include/linux/workqueue.h:518 [inline]
 wg_ratelimiter_init+0x19c/0x2c0 drivers/net/wireguard/ratelimiter.c:191
 wg_newlink+0x470/0x8f0 drivers/net/wireguard/device.c:367
 rtnl_newlink_create net/core/rtnetlink.c:3364 [inline]
 __rtnl_newlink+0x1087/0x17e0 net/core/rtnetlink.c:3581
 rtnl_newlink+0x68/0xa0 net/core/rtnetlink.c:3594
 rtnetlink_rcv_msg+0x43e/0xca0 net/core/rtnetlink.c:6091
 netlink_rcv_skb+0x157/0x430 net/netlink/af_netlink.c:2540
 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline]
 netlink_unicast+0x547/0x7f0 net/netlink/af_netlink.c:1345
 netlink_sendmsg+0x91b/0xe10 net/netlink/af_netlink.c:1921
 sock_sendmsg_nosec net/socket.c:714 [inline]
 sock_sendmsg+0xd3/0x120 net/socket.c:734
 __sys_sendto+0x23a/0x340 net/socket.c:2117
 __do_sys_sendto net/socket.c:2129 [inline]
 __se_sys_sendto net/socket.c:2125 [inline]
 __x64_sys_sendto+0xe1/0x1b0 net/socket.c:2125
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f0740e3e18c
Code: fa fa ff ff 44 8b 4c 24 2c 4c 8b 44 24 20 89 c5 44 8b 54 24 28 48 8b 54 24 18 b8 2c 00 00 00 48 8b 74 24 10 8b 7c 24 08 0f 05 <48> 3d 00 f0 ff ff 77 34 89 ef 48 89 44 24 08 e8 20 fb ff ff 48 8b
RSP: 002b:00007ffc5f21e690 EFLAGS: 00000293 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 00007f0741ad4620 RCX: 00007f0740e3e18c
RDX: 000000000000003c RSI: 00007f0741ad4670 RDI: 0000000000000003
RBP: 0000000000000000 R08: 00007ffc5f21e6e4 R09: 000000000000000c
R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000000
R13: 00007f0741ad4670 R14: 0000000000000003 R15: 0000000000000000
 </TASK>
bridge0: port 1(bridge_slave_0) entered blocking state
bridge0: port 1(bridge_slave_0) entered disabled state
device bridge_slave_0 entered promiscuous mode
bridge0: port 2(bridge_slave_1) entered blocking state
bridge0: port 2(bridge_slave_1) entered disabled state
device bridge_slave_1 entered promiscuous mode
bond0: (slave bond_slave_0): Enslaving as an active interface with an up link
bond0: (slave bond_slave_1): Enslaving as an active interface with an up link
team0: Port device team_slave_0 added
team0: Port device team_slave_1 added
batman_adv: batadv0: Adding interface: batadv_slave_0
batman_adv: batadv0: The MTU of interface batadv_slave_0 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
batman_adv: batadv0: Not using interface batadv_slave_0 (retrying later): interface not active
batman_adv: batadv0: Adding interface: batadv_slave_1
batman_adv: batadv0: The MTU of interface batadv_slave_1 is too small (1500) to handle the transport of batman-adv packets. Packets going over this interface will be fragmented on layer2 which could impact the performance. Setting the MTU to 1560 would solve the problem.
batman_adv: batadv0: Not using interface batadv_slave_1 (retrying later): interface not active
device hsr_slave_0 entered promiscuous mode
device hsr_slave_1 entered promiscuous mode
debugfs: Directory 'hsr0' with parent 'hsr' already present!
Cannot create hsr debugfs directory
netdevsim netdevsim2 netdevsim0: renamed from eth0
netdevsim netdevsim2 netdevsim1: renamed from eth1
netdevsim netdevsim2 netdevsim2: renamed from eth2
netdevsim netdevsim2 netdevsim3: renamed from eth3
8021q: adding VLAN 0 to HW filter on device bond0
8021q: adding VLAN 0 to HW filter on device team0
IPv6: ADDRCONF(NETDEV_CHANGE): hsr0: link becomes ready
8021q: adding VLAN 0 to HW filter on device batadv0
device veth0_vlan entered promiscuous mode
device veth1_vlan entered promiscuous mode
device veth0_macvtap entered promiscuous mode
device veth1_macvtap entered promiscuous mode
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3e) already exists on: batadv_slave_0
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: batadv0: Interface activated: batadv_slave_0
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3f) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: The newly added mac address (aa:aa:aa:aa:aa:3f) already exists on: batadv_slave_1
batman_adv: It is strongly recommended to keep mac addresses unique to avoid problems!
batman_adv: batadv0: Interface activated: batadv_slave_1
netdevsim netdevsim2 netdevsim0: set [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim2 netdevsim1: set [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim2 netdevsim2: set [1, 0] type 2 family 0 port 6081 - 0
netdevsim netdevsim2 netdevsim3: set [1, 0] type 2 family 0 port 6081 - 0
ieee80211 phy6: Selected rate control algorithm 'minstrel_ht'
ieee80211 phy8: Selected rate control algorithm 'minstrel_ht'

Crashes (24):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-qemu-upstream 2022/11/21 21:37 upstream eb7081409f94 f9a97739 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/18 22:02 upstream ab290eaddc4c 5bb70014 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/17 18:06 upstream 81ac25651a62 4ba8ab94 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/14 17:26 upstream 094226ad94f4 943f4cb8 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/13 17:12 upstream af7a05689189 7ba4d859 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/13 06:33 upstream fef7fd48922d f42ee5d8 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/12 16:04 upstream 8f2975c2bb4c f42ee5d8 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/11 10:27 upstream 4bbf3422df78 f42ee5d8 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/11 07:29 upstream 4bbf3422df78 f42ee5d8 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/06 12:16 upstream 2f5065a0bc9d 6d752409 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/11/04 23:17 upstream ee6050c8af96 6d752409 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/10/04 22:15 upstream 0326074ff465 267e3bb1 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/10/01 09:05 upstream ffb4d94b4314 feb56351 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/09/29 23:45 upstream 987a926c1d8a 45fd7169 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/09/29 09:40 upstream c3e0e1e23c70 a41a2080 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/09/28 23:19 upstream c3e0e1e23c70 a41a2080 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/09/28 12:43 upstream 49c13ed0316d e2556bc3 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream 2022/09/27 11:12 upstream a1375562c0a8 87840e00 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream-386 2022/11/18 14:32 upstream 84368d882b96 5bb70014 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream-386 2022/11/17 11:08 upstream cc675d22e422 3a127a31 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream-386 2022/11/12 16:15 upstream 8f2975c2bb4c f42ee5d8 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream-386 2022/11/09 09:34 upstream f141df371335 5fa28208 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream-386 2022/10/03 15:17 upstream 4fe89d07dcc2 feb56351 .config log report info possible deadlock in __mod_timer
ci-qemu-upstream-386 2022/10/02 11:59 upstream b357fd1c2afc feb56351 .config log report info possible deadlock in __mod_timer
* Struck through repros no longer work on HEAD.