bisecting fixing commit since 5b394b2ddf0347bef56e50c69a58773c94343ff3 building syzkaller on 758cd203cb82b2fd04496478a05650321520c099 testing commit 5b394b2ddf0347bef56e50c69a58773c94343ff3 with gcc (GCC) 8.1.0 all runs: crashed: WARNING: bad unlock balance in ucma_destroy_id testing current HEAD 59c36bc8d377c8764eb617a92211e0fc2f1318da testing commit 59c36bc8d377c8764eb617a92211e0fc2f1318da with gcc (GCC) 8.1.0 all runs: crashed: WARNING: bad unlock balance in ucma_destroy_id revisions tested: 2, total time: 17m14.997121036s (build: 8m34.02012998s, test: 7m16.255604985s) the crash still happens on HEAD crash: WARNING: bad unlock balance in ucma_destroy_id 8021q: adding VLAN 0 to HW filter on device team0 8021q: adding VLAN 0 to HW filter on device team0 8021q: adding VLAN 0 to HW filter on device team0 8021q: adding VLAN 0 to HW filter on device team0 ===================================== WARNING: bad unlock balance detected! 5.3.0-rc5+ #1 Not tainted ------------------------------------- syz-executor2/6873 is trying to release lock (&file->mut) at: [] ucma_destroy_id+0x23e/0x400 drivers/infiniband/core/ucma.c:621 but there are no more locks to release! other info that might help us debug this: 1 lock held by syz-executor2/6873: #0: 00000000522dfda4 (&file->mut){+.+.}, at: ucma_destroy_id+0x1de/0x400 drivers/infiniband/core/ucma.c:619 stack backtrace: CPU: 1 PID: 6873 Comm: syz-executor2 Not tainted 5.3.0-rc5+ #1 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+0x115/0x167 lib/dump_stack.c:113 print_unlock_imbalance_bug.cold.54+0x114/0x123 kernel/locking/lockdep.c:3933 __lock_release kernel/locking/lockdep.c:4169 [inline] lock_release+0x5f6/0x900 kernel/locking/lockdep.c:4431 __mutex_unlock_slowpath+0x8f/0x6a0 kernel/locking/mutex.c:1202 mutex_unlock+0xd/0x10 kernel/locking/mutex.c:714 ucma_destroy_id+0x23e/0x400 drivers/infiniband/core/ucma.c:621 ucma_write+0x206/0x2e0 drivers/infiniband/core/ucma.c:1684 __vfs_write+0x61/0x110 fs/read_write.c:494 vfs_write+0x191/0x4c0 fs/read_write.c:558 ksys_write+0x197/0x220 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x6e/0xb0 fs/read_write.c:620 do_syscall_64+0xd6/0x550 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4571d9 Code: fd b4 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 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f3c52ceac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f3c52ceb6d4 RCX: 00000000004571d9 RDX: 0000000000000018 RSI: 0000000020000480 RDI: 0000000000000005 RBP: 0000000000930140 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000004d7510 R14: 00000000004c1848 R15: 0000000000000001 ================================================================== BUG: KASAN: use-after-free in ucma_destroy_id+0x38c/0x400 drivers/infiniband/core/ucma.c:627 Read of size 4 at addr ffff8881c69b49e0 by task syz-executor2/6873 CPU: 1 PID: 6873 Comm: syz-executor2 Not tainted 5.3.0-rc5+ #1 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+0x115/0x167 lib/dump_stack.c:113 print_address_description+0x6f/0x2fe mm/kasan/report.c:351 __kasan_report.cold.7+0x1b/0x3f mm/kasan/report.c:482 kasan_report+0x12/0x17 mm/kasan/common.c:612 __asan_report_load4_noabort+0x14/0x20 mm/kasan/generic_report.c:131 ucma_destroy_id+0x38c/0x400 drivers/infiniband/core/ucma.c:627 ucma_write+0x206/0x2e0 drivers/infiniband/core/ucma.c:1684 __vfs_write+0x61/0x110 fs/read_write.c:494 vfs_write+0x191/0x4c0 fs/read_write.c:558 ksys_write+0x197/0x220 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x6e/0xb0 fs/read_write.c:620 do_syscall_64+0xd6/0x550 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x4571d9 Code: fd b4 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 cb b4 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007f3c52ceac78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f3c52ceb6d4 RCX: 00000000004571d9 RDX: 0000000000000018 RSI: 0000000020000480 RDI: 0000000000000005 RBP: 0000000000930140 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 00000000004d7510 R14: 00000000004c1848 R15: 0000000000000001 Allocated by task 6860: save_stack+0x21/0x90 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_kmalloc.constprop.7+0xc1/0xd0 mm/kasan/common.c:487 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:501 kmem_cache_alloc_trace+0x15b/0x760 mm/slab.c:3550 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:748 [inline] ucma_alloc_ctx+0x4c/0x430 drivers/infiniband/core/ucma.c:210 ucma_create_id+0xeb/0x550 drivers/infiniband/core/ucma.c:495 ucma_write+0x206/0x2e0 drivers/infiniband/core/ucma.c:1684 __vfs_write+0x61/0x110 fs/read_write.c:494 vfs_write+0x191/0x4c0 fs/read_write.c:558 ksys_write+0x197/0x220 fs/read_write.c:611 __do_sys_write fs/read_write.c:623 [inline] __se_sys_write fs/read_write.c:620 [inline] __x64_sys_write+0x6e/0xb0 fs/read_write.c:620 do_syscall_64+0xd6/0x550 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 6858: save_stack+0x21/0x90 mm/kasan/common.c:69 set_track mm/kasan/common.c:77 [inline] __kasan_slab_free+0x11a/0x170 mm/kasan/common.c:449 kasan_slab_free+0xe/0x10 mm/kasan/common.c:457 __cache_free mm/slab.c:3425 [inline] kfree+0xfa/0x290 mm/slab.c:3756 ucma_free_ctx+0x7a0/0xd50 drivers/infiniband/core/ucma.c:592 ucma_close+0x109/0x2d0 drivers/infiniband/core/ucma.c:1767 __fput+0x25a/0x780 fs/file_table.c:280 ____fput+0x9/0x10 fs/file_table.c:313 task_work_run+0x10e/0x190 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x1be/0x210 arch/x86/entry/common.c:163 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x468/0x550 arch/x86/entry/common.c:299 entry_SYSCALL_64_after_hwframe+0x49/0xbe The buggy address belongs to the object at ffff8881c69b4940 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 160 bytes inside of 256-byte region [ffff8881c69b4940, ffff8881c69b4a40) The buggy address belongs to the page: page:ffffea00071a6d00 refcount:1 mapcount:0 mapping:ffff8881da0008c0 index:0x0 flags: 0x2fffc0000000200(slab) raw: 02fffc0000000200 ffffea000726b208 ffffea000748b1c8 ffff8881da0008c0 raw: 0000000000000000 ffff8881c69b4080 000000010000000c 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c69b4880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c69b4900: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff8881c69b4980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c69b4a00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8881c69b4a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ==================================================================