================================ WARNING: inconsistent lock state 5.5.0-rc6-next-20200116-syzkaller #0 Not tainted -------------------------------- inconsistent {SOFTIRQ-ON-W} -> {IN-SOFTIRQ-W} usage. modprobe/24513 [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: 3124 hardirqs last enabled at (3124): [] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline] hardirqs last enabled at (3124): [] _raw_spin_unlock_irq+0x23/0x80 kernel/locking/spinlock.c:199 hardirqs last disabled at (3123): [] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline] hardirqs last disabled at (3123): [] _raw_spin_lock_irq+0x3a/0x80 kernel/locking/spinlock.c:167 softirqs last enabled at (170): [] copy_init_fpstate_to_fpregs arch/x86/kernel/fpu/core.c:308 [inline] softirqs last enabled at (170): [] fpu__clear+0x17c/0x440 arch/x86/kernel/fpu/core.c:332 softirqs last disabled at (1411): [] invoke_softirq kernel/softirq.c:373 [inline] softirqs last disabled at (1411): [] 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 *** 3 locks held by modprobe/24513: #0: ffffffff8a01bbe8 (tomoyo_ss){....}, at: tomoyo_path_perm+0x1cb/0x430 security/tomoyo/file.c:847 #1: ffffffff89c67fc8 (remove_cache_srcu){....}, at: quarantine_reduce+0x63/0x1a0 mm/kasan/quarantine.c:262 #2: ffffc90000007d50 ((&ima_key_queue_timer)){+.-.}, at: lockdep_copy_map include/linux/lockdep.h:172 [inline] #2: ffffc90000007d50 ((&ima_key_queue_timer)){+.-.}, at: call_timer_fn+0xe0/0x780 kernel/time/timer.c:1394 stack backtrace: CPU: 0 PID: 24513 Comm: modprobe 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:__sanitizer_cov_trace_const_cmp8+0x0/0x20 kernel/kcov.c:280 Code: ff ff 5d c3 66 0f 1f 44 00 00 55 89 f2 89 fe bf 05 00 00 00 48 89 e5 48 8b 4d 08 e8 ba fe ff ff 5d c3 0f 1f 84 00 00 00 00 00 <55> 48 89 f2 48 89 fe bf 07 00 00 00 48 89 e5 48 8b 4d 08 e8 98 fe RSP: 0018:ffffc90003457820 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: 0000000000000005 RBX: 0000000000000000 RCX: 000000000000002e RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: ffffc90003457840 R08: ffff8880a34520c0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 00000000a2969da8 R13: ffff888122969da8 R14: ffffc90003457890 R15: 0000000000000000 virt_to_head_page include/linux/mm.h:721 [inline] qlink_to_cache mm/kasan/quarantine.c:128 [inline] qlist_free_all+0xc7/0x150 mm/kasan/quarantine.c:164 quarantine_reduce+0x15e/0x1a0 mm/kasan/quarantine.c:260 __kasan_kmalloc.constprop.0+0xa3/0xe0 mm/kasan/common.c:496 kasan_slab_alloc+0xf/0x20 mm/kasan/common.c:523 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc mm/slab.c:3320 [inline] __do_kmalloc mm/slab.c:3654 [inline] __kmalloc+0x14c/0x770 mm/slab.c:3665 kmalloc include/linux/slab.h:560 [inline] tomoyo_realpath_from_path+0xc5/0x660 security/tomoyo/realpath.c:252 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x230/0x430 security/tomoyo/file.c:822 tomoyo_inode_getattr+0x1d/0x30 security/tomoyo/tomoyo.c:129 security_inode_getattr+0xf2/0x150 security/security.c:1255 vfs_getattr+0x25/0x70 fs/stat.c:117 vfs_statx+0x15d/0x200 fs/stat.c:201 vfs_fstatat include/linux/fs.h:3266 [inline] __do_sys_newfstatat+0xad/0x130 fs/stat.c:378 __se_sys_newfstatat fs/stat.c:372 [inline] __x64_sys_newfstatat+0x97/0xf0 fs/stat.c:372 do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x7fd946787e1a Code: 83 c8 ff c3 90 90 90 90 90 90 90 90 90 90 90 90 83 ff 01 89 f0 48 89 d6 77 1e 48 63 f8 4d 63 d0 48 89 ca b8 06 01 00 00 0f 05 <48> 3d 00 f0 ff ff 77 1a f3 c3 0f 1f 40 00 48 8b 05 e9 4f 2b 00 64 RSP: 002b:00007ffe8f962228 EFLAGS: 00000246 ORIG_RAX: 0000000000000106 RAX: ffffffffffffffda RBX: 00007fd946a53471 RCX: 00007fd946787e1a RDX: 00007ffe8f9623b0 RSI: 00007ffe8f962453 RDI: 0000000000000000 RBP: 00007fd946c582e8 R08: 0000000000000000 R09: 7665646266080028 R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffe8f962440 R13: 00007ffe8f962453 R14: 000055e0d881b1c0 R15: 00055facc785c680