WARNING: locking bug in nr_release

From: syzbot
Date: Mon Jan 07 2019 - 04:52:07 EST


Hello,

syzbot found the following crash on:

HEAD commit: 574823bfab82 Change mincore() to count "mapped" pages rath..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=121dc980c00000
kernel config: https://syzkaller.appspot.com/x/.config?x=d55557b516c45456
dashboard link: https://syzkaller.appspot.com/bug?extid=23f5ac6e7c0b6cc63734
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+23f5ac6e7c0b6cc63734@xxxxxxxxxxxxxxxxxxxxxxxxx

------------[ cut here ]------------
DEBUG_LOCKS_WARN_ON(class_idx > MAX_LOCKDEP_KEYS)
WARNING: CPU: 1 PID: 30980 at kernel/locking/lockdep.c:3315 __lock_acquire+0x14cd/0x4a30 kernel/locking/lockdep.c:3315
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 30980 Comm: syz-executor5 Not tainted 4.20.0+ #13
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+0x1db/0x2d0 lib/dump_stack.c:113
panic+0x2cb/0x65c kernel/panic.c:214
__warn.cold+0x20/0x48 kernel/panic.c:571
report_bug+0x263/0x2b0 lib/bug.c:186
fixup_bug arch/x86/kernel/traps.c:178 [inline]
fixup_bug arch/x86/kernel/traps.c:173 [inline]
do_error_trap+0x11b/0x200 arch/x86/kernel/traps.c:271
do_invalid_op+0x37/0x50 arch/x86/kernel/traps.c:290
invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:973
RIP: 0010:__lock_acquire+0x14cd/0x4a30 kernel/locking/lockdep.c:3315
Code: 8b 1d 3b eb f7 08 45 85 db 0f 85 f0 f3 ff ff 48 c7 c6 60 a1 4b 88 48 c7 c7 80 76 4b 88 44 89 9c 24 98 00 00 00 e8 f3 5f e7 ff <0f> 0b 44 8b 9c 24 98 00 00 00 e9 c9 f3 ff ff 8b 0d 2e 9c f2 09 85
RSP: 0018:ffff8880710cf0c0 EFLAGS: 00010086
RAX: 0000000000000000 RBX: 00000000fffe4386 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffffffff81684ce6 RDI: 0000000000000006
RBP: ffff8880710cf350 R08: ffff888081d582c0 R09: fffffbfff1333299
R10: fffffbfff1333298 R11: ffffffff899994c3 R12: ffff888081d582c0
R13: ffff888081d58b8a R14: 0000000000000001 R15: 00000000fffe4386
kobject: 'kvm' (00000000d564ee4d): kobject_uevent_env
lock_acquire+0x1db/0x570 kernel/locking/lockdep.c:3841
kobject: 'kvm' (00000000d564ee4d): fill_kobj_path: path = '/devices/virtual/misc/kvm'
__raw_write_lock_bh include/linux/rwlock_api_smp.h:203 [inline]
_raw_write_lock_bh+0x33/0x50 kernel/locking/spinlock.c:312
sock_orphan include/net/sock.h:1796 [inline]
nr_release+0x6a/0x3c0 net/netrom/af_netrom.c:524
__sock_release+0xd3/0x250 net/socket.c:579
sock_close+0x1b/0x30 net/socket.c:1141
__fput+0x3c5/0xb10 fs/file_table.c:278
____fput+0x16/0x20 fs/file_table.c:309
task_work_run+0x1f4/0x2b0 kernel/task_work.c:113
exit_task_work include/linux/task_work.h:22 [inline]
do_exit+0x19d6/0x2650 kernel/exit.c:867
do_group_exit+0x177/0x430 kernel/exit.c:970
get_signal+0x8b4/0x19b0 kernel/signal.c:2517
do_signal+0x91/0x1ea0 arch/x86/kernel/signal.c:816
exit_to_usermode_loop+0x2f7/0x3b0 arch/x86/entry/common.c:162
prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
do_syscall_64+0x696/0x800 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x457ec9
Code: 6d b7 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 3b b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f52aee87cf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000073c048 RCX: 0000000000457ec9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000073c048
RBP: 000000000073c040 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000073c04c
R13: 00007ffe776ee8af R14: 00007f52aee889c0 R15: 000000000073c04c
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxxx

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with syzbot.