================================ WARNING: inconsistent lock state 5.5.0-rc6-next-20200116-syzkaller #0 Not tainted -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. syz-executor.4/11272 [HC0[0]:SC1[1]:HE1:SE0] takes: ffffffff8a03ce58 (ima_keys_lock){+.?.}, at: spin_lock include/linux/spinlock.h:338 [inline] ffffffff8a03ce58 (ima_keys_lock){+.?.}, at: ima_process_queued_keys+0x4f/0x320 security/integrity/ima/ima_asymmetric_keys.c:144 {SOFTIRQ-ON-W} state was registered at: lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4484 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] ima_queue_key security/integrity/ima/ima_asymmetric_keys.c:111 [inline] ima_post_key_create_or_update+0x234/0x470 security/integrity/ima/ima_asymmetric_keys.c:194 key_create_or_update+0x6b8/0xcb0 security/keys/key.c:944 load_system_certificate_list+0x1ba/0x25e certs/system_keyring.c:161 do_one_initcall+0x120/0x820 init/main.c:1109 do_initcall_level init/main.c:1182 [inline] do_initcalls init/main.c:1198 [inline] do_basic_setup init/main.c:1218 [inline] kernel_init_freeable+0x522/0x5d0 init/main.c:1402 kernel_init+0x12/0x1bf init/main.c:1309 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352 irq event stamp: 695650 hardirqs last enabled at (695650): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline] hardirqs last enabled at (695650): [] _raw_spin_unlock_irq+0x23/0x80 kernel/locking/spinlock.c:199 hardirqs last disabled at (695649): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (695649): [] _raw_spin_lock_irq+0x3a/0x80 kernel/locking/spinlock.c:167 softirqs last enabled at (695174): [] get_next_corpse net/netfilter/nf_conntrack_core.c:2002 [inline] softirqs last enabled at (695174): [] nf_ct_iterate_cleanup+0x1ec/0x4e0 net/netfilter/nf_conntrack_core.c:2035 softirqs last disabled at (695177): [] invoke_softirq kernel/softirq.c:373 [inline] softirqs last disabled at (695177): [] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(ima_keys_lock); lock(ima_keys_lock); *** DEADLOCK *** 6 locks held by syz-executor.4/11272: #0: ffffffff8a79d2e8 (cb_lock){++++}, at: genl_rcv+0x1a/0x40 net/netlink/genetlink.c:744 #1: ffffffff8a79d3a0 (genl_mutex){+.+.}, at: genl_lock net/netlink/genetlink.c:33 [inline] #1: ffffffff8a79d3a0 (genl_mutex){+.+.}, at: genl_rcv_msg+0x7de/0xea0 net/netlink/genetlink.c:732 #2: ffffffff8a7678e0 (devlink_mutex){+.+.}, at: devlink_nl_pre_doit+0x2a/0x6c0 net/core/devlink.c:402 #3: ffff8880a24a6ae0 (&nsim_dev->port_list_lock){+.+.}, at: nsim_dev_port_del_all+0x2d/0xe0 drivers/net/netdevsim/dev.c:684 #4: ffffffff8a7479c0 (rtnl_mutex){+.+.}, at: rtnl_lock+0x17/0x20 net/core/rtnetlink.c:72 #5: ffffc90000007d50 ((&ima_key_queue_timer)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #5: ffffc90000007d50 ((&ima_key_queue_timer)){+.-.}, at: call_timer_fn+0xe0/0x780 kernel/time/timer.c:1394 stack backtrace: CPU: 0 PID: 11272 Comm: syz-executor.4 Not tainted 5.5.0-rc6-next-20200116-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x197/0x210 lib/dump_stack.c:118 print_usage_bug.cold+0x327/0x378 kernel/locking/lockdep.c:3100 valid_state kernel/locking/lockdep.c:3111 [inline] mark_lock_irq kernel/locking/lockdep.c:3308 [inline] mark_lock+0xbb4/0x1220 kernel/locking/lockdep.c:3665 mark_usage kernel/locking/lockdep.c:3565 [inline] __lock_acquire+0x1e8e/0x4a00 kernel/locking/lockdep.c:3908 lock_acquire+0x190/0x410 kernel/locking/lockdep.c:4484 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:338 [inline] ima_process_queued_keys+0x4f/0x320 security/integrity/ima/ima_asymmetric_keys.c:144 ima_timer_handler+0x15/0x20 security/integrity/ima/ima_asymmetric_keys.c:46 call_timer_fn+0x1ac/0x780 kernel/time/timer.c:1404 expire_timers kernel/time/timer.c:1449 [inline] __run_timers kernel/time/timer.c:1773 [inline] __run_timers kernel/time/timer.c:1740 [inline] run_timer_softirq+0x6c3/0x1790 kernel/time/timer.c:1786 __do_softirq+0x262/0x98c kernel/softirq.c:292 invoke_softirq kernel/softirq.c:373 [inline] irq_exit+0x19b/0x1e0 kernel/softirq.c:413 exiting_irq arch/x86/include/asm/apic.h:536 [inline] smp_apic_timer_interrupt+0x1a3/0x610 arch/x86/kernel/apic/apic.c:1137 apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:829 RIP: 0010:should_resched arch/x86/include/asm/preempt.h:102 [inline] RIP: 0010:__local_bh_enable_ip+0x18e/0x270 kernel/softirq.c:196 Code: 00 00 00 00 fc ff df 48 c1 e8 03 80 3c 10 00 0f 85 df 00 00 00 48 83 3d 47 31 6c 08 00 0f 84 8f 00 00 00 fb 66 0f 1f 44 00 00 <65> 8b 05 33 95 ba 7e 85 c0 74 7f 5b 41 5c 41 5d 5d c3 80 3d 0e ff RSP: 0018:ffffc9000508ef80 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff1367751 RBX: 0000000000000200 RCX: 0000000000000006 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff888050588b5c RBP: ffffc9000508ef98 R08: 1ffffffff16a51a7 R09: fffffbfff16a51a8 R10: fffffbfff16a51a7 R11: ffffffff8b528d3f R12: ffffffff8672ee9c R13: ffff8880505882c0 R14: 0000000000000001 R15: dffffc0000000000 local_bh_enable include/linux/bottom_half.h:32 [inline] get_next_corpse net/netfilter/nf_conntrack_core.c:2012 [inline] nf_ct_iterate_cleanup+0x212/0x4e0 net/netfilter/nf_conntrack_core.c:2035 nf_ct_iterate_cleanup_net net/netfilter/nf_conntrack_core.c:2120 [inline] nf_ct_iterate_cleanup_net+0x133/0x190 net/netfilter/nf_conntrack_core.c:2105 masq_device_event+0xb5/0xe0 net/netfilter/nf_nat_masquerade.c:88 notifier_call_chain+0xc2/0x230 kernel/notifier.c:83 __raw_notifier_call_chain kernel/notifier.c:361 [inline] raw_notifier_call_chain+0x2e/0x40 kernel/notifier.c:368 call_netdevice_notifiers_info net/core/dev.c:1893 [inline] call_netdevice_notifiers_info+0xba/0x130 net/core/dev.c:1878 call_netdevice_notifiers_extack net/core/dev.c:1905 [inline] call_netdevice_notifiers net/core/dev.c:1919 [inline] dev_close_many+0x32a/0x6c0 net/core/dev.c:1544 rollback_registered_many+0x42e/0x1030 net/core/dev.c:8736 rollback_registered+0x109/0x1d0 net/core/dev.c:8804 unregister_netdevice_queue net/core/dev.c:9903 [inline] unregister_netdevice_queue+0x1ee/0x2c0 net/core/dev.c:9896 unregister_netdevice include/linux/netdevice.h:2677 [inline] nsim_destroy+0x3a/0x70 drivers/net/netdevsim/netdev.c:330 __nsim_dev_port_del+0x150/0x1f0 drivers/net/netdevsim/dev.c:674 nsim_dev_port_del_all+0x8b/0xe0 drivers/net/netdevsim/dev.c:687 nsim_dev_reload_destroy+0x58/0xf0 drivers/net/netdevsim/dev.c:856 nsim_dev_reload_down+0x73/0xe0 drivers/net/netdevsim/dev.c:493 devlink_reload+0xc8/0x3c0 net/core/devlink.c:2797 devlink_nl_cmd_reload+0x308/0x7e0 net/core/devlink.c:2832 genl_family_rcv_msg_doit net/netlink/genetlink.c:672 [inline] genl_family_rcv_msg net/netlink/genetlink.c:717 [inline] genl_rcv_msg+0x67d/0xea0 net/netlink/genetlink.c:734 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2477 genl_rcv+0x29/0x40 net/netlink/genetlink.c:745 netlink_unicast_kernel net/netlink/af_netlink.c:1302 [inline] netlink_unicast+0x59e/0x7e0 net/netlink/af_netlink.c:1328 netlink_sendmsg+0x91c/0xea0 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:652 [inline] sock_sendmsg+0xd7/0x130 net/socket.c:672 ____sys_sendmsg+0x753/0x880 net/socket.c:2343 ___sys_sendmsg+0x100/0x170 net/socket.c:2397 __sys_sendmsg+0x105/0x1d0 net/socket.c:2430 __do_sys_sendmsg net/socket.c:2439 [inline] __se_sys_sendmsg net/socket.c:2437 [inline] __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2437 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45b399 Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f9b10557c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f9b105586d4 RCX: 000000000045b399 RDX: 0000000000000000 RSI: 0000000020000800 RDI: 0000000000000004 RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000000008e9 R14: 00000000004ca3ec R15: 000000000075bf2c