syzbot


WARNING: bad unlock balance in ucma_event_handler

Status: upstream: reported C repro on 2019/10/08 08:22
Reported-by: syzbot+b703fa607d1fc3f80e5b@syzkaller.appspotmail.com
First crash: 1002d, last: 272d

Fix bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 WARNING: bad unlock balance in ucma_event_handler C inconclusive 2 420d 917d 0/1 upstream: reported C repro on 2020/01/02 01:32
upstream WARNING: bad unlock balance in ucma_event_handler C done 143 820d 1484d 17/22 fixed on 2020/05/10 10:42

Sample crash report:
audit: type=1400 audit(1577941332.011:36): avc:  denied  { map } for  pid=7724 comm="syz-executor251" path="/root/syz-executor251409847" dev="sda1" ino=16483 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
=====================================
WARNING: bad unlock balance detected!
4.19.92-syzkaller #0 Not tainted
-------------------------------------
kworker/u4:3/184 is trying to release lock (&file->mut) at:
[<ffffffff85564cf1>] ucma_event_handler+0x711/0xef0 drivers/infiniband/core/ucma.c:394
but there are no more locks to release!

other info that might help us debug this:
4 locks held by kworker/u4:3/184:
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: __write_once_size include/linux/compiler.h:220 [inline]
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: arch_atomic64_set arch/x86/include/asm/atomic64_64.h:34 [inline]
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: atomic64_set include/asm-generic/atomic-instrumented.h:40 [inline]
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: atomic_long_set include/asm-generic/atomic-long.h:59 [inline]
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: set_work_data kernel/workqueue.c:617 [inline]
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: set_work_pool_and_clear_pending kernel/workqueue.c:644 [inline]
 #0: 0000000086f9aafc ((wq_completion)"ib_addr"){+.+.}, at: process_one_work+0x87e/0x1750 kernel/workqueue.c:2124
 #1: 000000004776d5af ((work_completion)(&(&req->work)->work)){+.+.}, at: process_one_work+0x8b4/0x1750 kernel/workqueue.c:2128
 #2: 0000000097e2b64c (&id_priv->handler_mutex){+.+.}, at: addr_handler+0xaf/0x3e0 drivers/infiniband/core/cma.c:2874
 #3: 00000000b74af1e5 (&file->mut){+.+.}, at: ucma_event_handler+0xb3/0xef0 drivers/infiniband/core/ucma.c:354

stack backtrace:
CPU: 0 PID: 184 Comm: kworker/u4:3 Not tainted 4.19.92-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: ib_addr process_one_req
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x197/0x210 lib/dump_stack.c:118
 print_unlock_imbalance_bug kernel/locking/lockdep.c:3464 [inline]
 print_unlock_imbalance_bug.cold+0x114/0x123 kernel/locking/lockdep.c:3441
 __lock_release kernel/locking/lockdep.c:3674 [inline]
 lock_release+0x6cd/0xa30 kernel/locking/lockdep.c:3922
 __mutex_unlock_slowpath+0x8e/0x6b0 kernel/locking/mutex.c:1197
 mutex_unlock+0xd/0x10 kernel/locking/mutex.c:713
 ucma_event_handler+0x711/0xef0 drivers/infiniband/core/ucma.c:394
 addr_handler+0x2f1/0x3e0 drivers/infiniband/core/cma.c:2907
 process_one_req+0xfc/0x640 drivers/infiniband/core/addr.c:570
 process_one_work+0x989/0x1750 kernel/workqueue.c:2153
 worker_thread+0x98/0xe40 kernel/workqueue.c:2296
 kthread+0x354/0x420 kernel/kthread.c:246
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Crashes (13):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci2-linux-4-19 2020/01/02 05:05 linux-4.19.y c7ecf3e3a71c 25a0186e .config log report syz C
ci2-linux-4-19 2021/10/07 05:15 linux-4.19.y 6db10b4d5efd 62ee0987 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/10/06 04:39 linux-4.19.y c2276d585654 0a63fd36 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/10/03 03:16 linux-4.19.y c2276d585654 db0f5787 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/04/26 23:31 linux-4.19.y 2965db2e004c 8ee2dea6 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/04/24 12:18 linux-4.19.y 2965db2e004c 17f0b706 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/04/24 07:19 linux-4.19.y 2965db2e004c 17f0b706 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/03/10 22:00 linux-4.19.y 2cae3e25b706 764067f3 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2021/03/10 19:35 linux-4.19.y 2cae3e25b706 764067f3 .config log report info WARNING: bad unlock balance in ucma_event_handler
ci2-linux-4-19 2020/11/27 00:07 linux-4.19.y 0c88e405c97e 5018c946 .config log report info
ci2-linux-4-19 2019/11/20 19:34 linux-4.19.y c555efaf1402 432c7650 .config log report
ci2-linux-4-19 2019/11/08 06:58 linux-4.19.y 5ee93551c703 f39aff9e .config log report
ci2-linux-4-19 2019/10/08 07:21 linux-4.19.y 58fce2064530 28ac6e64 .config log report