================================ WARNING: inconsistent lock state 5.5.0-rc6-next-20200116-syzkaller #0 Not tainted -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. udevd/12424 [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: 412 hardirqs last enabled at (412): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline] hardirqs last enabled at (412): [] _raw_spin_unlock_irq+0x23/0x80 kernel/locking/spinlock.c:199 hardirqs last disabled at (411): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (411): [] _raw_spin_lock_irq+0x3a/0x80 kernel/locking/spinlock.c:167 softirqs last enabled at (0): [] copy_process+0x1ad2/0x7290 kernel/fork.c:2027 softirqs last disabled at (409): [] invoke_softirq kernel/softirq.c:373 [inline] softirqs last disabled at (409): [] 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 *** 4 locks held by udevd/12424: #0: ffff88809ebb7f10 (&sig->cred_guard_mutex){+.+.}, at: prepare_bprm_creds fs/exec.c:1413 [inline] #0: ffff88809ebb7f10 (&sig->cred_guard_mutex){+.+.}, at: __do_execve_file.isra.0+0x376/0x22b0 fs/exec.c:1758 #1: ffff88808d404b58 (&mm->mmap_sem#2){++++}, at: exec_mmap fs/exec.c:1032 [inline] #1: ffff88808d404b58 (&mm->mmap_sem#2){++++}, at: flush_old_exec+0x5d1/0x1de0 fs/exec.c:1285 #2: ffff88804ef26dc0 (&(&p->alloc_lock)->rlock){+.+.}, at: spin_lock include/linux/spinlock.h:338 [inline] #2: ffff88804ef26dc0 (&(&p->alloc_lock)->rlock){+.+.}, at: task_lock include/linux/sched/task.h:171 [inline] #2: ffff88804ef26dc0 (&(&p->alloc_lock)->rlock){+.+.}, at: exec_mmap fs/exec.c:1038 [inline] #2: ffff88804ef26dc0 (&(&p->alloc_lock)->rlock){+.+.}, at: flush_old_exec+0x617/0x1de0 fs/exec.c:1285 #3: ffffc90000d98d50 ((&ima_key_queue_timer)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #3: ffffc90000d98d50 ((&ima_key_queue_timer)){+.-.}, at: call_timer_fn+0xe0/0x780 kernel/time/timer.c:1394 stack backtrace: CPU: 1 PID: 12424 Comm: udevd 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:arch_local_irq_restore arch/x86/include/asm/paravirt.h:752 [inline] RIP: 0010:lock_acquire+0x20b/0x410 kernel/locking/lockdep.c:4487 Code: 9c 08 00 00 00 00 00 00 48 c1 e8 03 80 3c 10 00 0f 85 d3 01 00 00 48 83 3d 49 7d 58 08 00 0f 84 53 01 00 00 48 8b 7d c8 57 9d <0f> 1f 44 00 00 48 8d 65 d8 5b 41 5c 41 5d 41 5e 41 5f 5d c3 65 8b RSP: 0018:ffffc900030efaf0 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13 RAX: 1ffffffff136774f RBX: ffff88804ef26600 RCX: ffffffff815af092 RDX: dffffc0000000000 RSI: 0000000000000008 RDI: 0000000000000286 RBP: ffffc900030efb38 R08: 0000000000007d77 R09: fffffbfff16a51a7 R10: ffff88804ef26ef0 R11: ffff88804ef26600 R12: ffff88804ef26dc0 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 __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] task_lock include/linux/sched/task.h:171 [inline] exec_mmap fs/exec.c:1038 [inline] flush_old_exec+0x617/0x1de0 fs/exec.c:1285 load_elf_binary+0x89e/0x4b30 fs/binfmt_elf.c:848 search_binary_handler fs/exec.c:1663 [inline] search_binary_handler+0x16d/0x570 fs/exec.c:1640 exec_binprm fs/exec.c:1706 [inline] __do_execve_file.isra.0+0x1329/0x22b0 fs/exec.c:1826 do_execveat_common fs/exec.c:1872 [inline] do_execve fs/exec.c:1889 [inline] __do_sys_execve fs/exec.c:1965 [inline] __se_sys_execve fs/exec.c:1960 [inline] __x64_sys_execve+0x8f/0xc0 fs/exec.c:1960 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7f5e09c30207 Code: 77 19 f4 48 89 d7 44 89 c0 0f 05 48 3d 00 f0 ff ff 76 e0 f7 d8 64 41 89 01 eb d8 f7 d8 64 41 89 01 eb df b8 3b 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 02 f3 c3 48 8b 15 00 8c 2d 00 f7 d8 64 89 02 RSP: 002b:00007fffd17b7558 EFLAGS: 00000202 ORIG_RAX: 000000000000003b RAX: ffffffffffffffda RBX: 00000000ffffffff RCX: 00007f5e09c30207 RDX: 00000000021cc180 RSI: 00007fffd17b7650 RDI: 00007fffd17b8660 RBP: 0000000000625500 R08: 00000000000027b2 R09: 00000000000027b2 R10: 0000000000000000 R11: 0000000000000202 R12: 00000000021cc180 R13: 0000000000000007 R14: 00000000021ba250 R15: 0000000000000005