WARNING: bad unlock balance in get_user_pages_unlocked

Status: fixed on 2020/06/28 13:52
Subsystems: mm
[Documentation on labels]
Fix commit: c7b6a566b985 mm/gup: Mark lock taken only after a successful retake
First crash: 1511d, last: 1511d
Discussions (1)
Title Replies (including bot) Last reply
WARNING: bad unlock balance in get_user_pages_unlocked 0 (1) 2020/04/08 10:28

Sample crash report:
WARNING: bad unlock balance detected!
5.6.0-syzkaller #0 Not tainted
syz-executor.2/13432 is trying to release lock (&mm->mmap_sem) at:
[<ffffffff819f2464>] get_user_pages_unlocked+0x4a4/0x610 mm/gup.c:2032
but there are no more locks to release!

other info that might help us debug this:
no locks held by syz-executor.2/13432.

stack backtrace:
CPU: 0 PID: 13432 Comm: syz-executor.2 Not tainted 5.6.0-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+0x188/0x20d lib/dump_stack.c:118
 __lock_release kernel/locking/lockdep.c:4633 [inline]
 lock_release+0x586/0x800 kernel/locking/lockdep.c:4941
 up_read+0x79/0x750 kernel/locking/rwsem.c:1573
 get_user_pages_unlocked+0x4a4/0x610 mm/gup.c:2032
 __gup_longterm_unlocked mm/gup.c:2735 [inline]
 internal_get_user_pages_fast+0x44a/0x4e0 mm/gup.c:2776
 get_user_pages_fast+0x49/0x70 mm/gup.c:2824
 iov_iter_get_pages+0x29f/0x10c0 lib/iov_iter.c:1322
 __bio_iov_iter_get_pages block/bio.c:989 [inline]
 bio_iov_iter_get_pages+0x1c6/0xa50 block/bio.c:1045
 __blkdev_direct_IO fs/block_dev.c:387 [inline]
 blkdev_direct_IO+0x991/0x1360 fs/block_dev.c:477
 generic_file_read_iter+0x30a/0x2b10 mm/filemap.c:2276
 blkdev_read_iter+0x11b/0x180 fs/block_dev.c:2053
 call_read_iter include/linux/fs.h:1901 [inline]
 aio_read+0x258/0x3b0 fs/aio.c:1543
 __io_submit_one fs/aio.c:1829 [inline]
 io_submit_one+0xff9/0x2ec0 fs/aio.c:1878
 __do_sys_io_submit fs/aio.c:1937 [inline]
 __se_sys_io_submit fs/aio.c:1907 [inline]
 __x64_sys_io_submit+0x1bd/0x540 fs/aio.c:1907
 do_syscall_64+0xf6/0x7d0 arch/x86/entry/common.c:295
RIP: 0033:0x45c849
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:00007fd221794c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000d1
RAX: ffffffffffffffda RBX: 00007fd2217956d4 RCX: 000000000045c849
RDX: 00000000200000c0 RSI: 0000000000000008 RDI: 00007fd221774000
RBP: 000000000076bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 00000000000001f9 R14: 00000000004c422b R15: 000000000076bf0c
------------[ cut here ]------------
DEBUG_RWSEMS_WARN_ON(tmp < 0): count = 0xffffffffffffff00, magic = 0xffff8880959003f8, owner = 0x1, curr 0xffff88804e98c340, list empty
WARNING: CPU: 1 PID: 13432 at kernel/locking/rwsem.c:1435 __up_read kernel/locking/rwsem.c:1435 [inline]
WARNING: CPU: 1 PID: 13432 at kernel/locking/rwsem.c:1435 up_read+0x5f9/0x750 kernel/locking/rwsem.c:1574

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/03 17:38 upstream bef7b2a7be28 5ed396e6 .config console log report ci-upstream-kasan-gce
* Struck through repros no longer work on HEAD.