syzbot


BUG: spinlock bad magic in rhashtable_walk_enter

Status: fixed on 2019/06/24 23:41
Subsystems: tipc
[Documentation on labels]
Reported-by: syzbot+01dd5c4b3c34a5cf9308@syzkaller.appspotmail.com
Fix commit: 526f5b851a96 tipc: fix modprobe tipc failed after switch order of device registration
First crash: 1748d, last: 1743d
Cause bisection: introduced by (bisect log) :
commit 7e27e8d6130c5e88fac9ddec4249f7f2337fe7f8
Author: Junwei Hu <hujunwei4@huawei.com>
Date: Thu May 16 02:51:15 2019 +0000

  tipc: switch order of device registration to fix a crash

Crash: KASAN: use-after-free Read in rhashtable_walk_enter (log)
Repro: C syz .config
  
Discussions (1)
Title Replies (including bot) Last reply
BUG: spinlock bad magic in rhashtable_walk_enter 1 (3) 2019/05/24 02:53

Sample crash report:
BUG: spinlock bad magic on CPU#0, syz-executor769/8857
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 8857 Comm: syz-executor769 Not tainted 5.2.0-rc1+ #21
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:task_pid_nr include/linux/sched.h:1240 [inline]
RIP: 0010:spin_dump.cold+0xa2/0xe6 kernel/locking/spinlock_debug.c:65
Code: 4e 4d 02 00 e8 c5 52 bd 05 58 5b 41 5c 41 5d 41 5e 5d c3 48 8d bb d0 04 00 00 b8 ff ff 37 00 48 89 fa 48 c1 e0 2a 48 c1 ea 03 <0f> b6 04 02 84 c0 74 04 3c 03 7e 24 44 8b ab d0 04 00 00 48 81 c3
RSP: 0018:ffff88808e767538 EFLAGS: 00010203
RAX: dffffc0000000000 RBX: 000000000ab1cf7e RCX: 0000000000000000
RDX: 0000000001563a89 RSI: ffffffff815ac7e6 RDI: 000000000ab1d44e
RBP: ffff88808e767560 R08: 0000000000000036 R09: ffffed1015d06011
R10: ffffed1015d06010 R11: ffff8880ae830087 R12: ffff88821661b4a8
R13: ffff8880a7748600 R14: ffff88821661a280 R15: ffff88808e7675d8
FS:  0000555555c99880(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000040 CR3: 000000009b9e6000 CR4: 00000000001406f0
Call Trace:
 spin_bug kernel/locking/spinlock_debug.c:75 [inline]
 debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
 do_raw_spin_lock+0x231/0x2e0 kernel/locking/spinlock_debug.c:112
 __raw_spin_lock include/linux/spinlock_api_smp.h:143 [inline]
 _raw_spin_lock+0x37/0x40 kernel/locking/spinlock.c:151
 spin_lock include/linux/spinlock.h:338 [inline]
 rhashtable_walk_enter+0xf9/0x390 lib/rhashtable.c:669
 __tipc_dump_start+0x1fa/0x3c0 net/tipc/socket.c:3414
 tipc_dump_start+0x70/0x90 net/tipc/socket.c:3396
 __netlink_dump_start+0x4f8/0x7d0 net/netlink/af_netlink.c:2351
 netlink_dump_start include/linux/netlink.h:226 [inline]
 tipc_sock_diag_handler_dump+0x1d9/0x270 net/tipc/diag.c:91
 __sock_diag_cmd net/core/sock_diag.c:232 [inline]
 sock_diag_rcv_msg+0x319/0x410 net/core/sock_diag.c:263
 netlink_rcv_skb+0x177/0x450 net/netlink/af_netlink.c:2486
 sock_diag_rcv+0x2b/0x40 net/core/sock_diag.c:274
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x531/0x710 net/netlink/af_netlink.c:1337
 netlink_sendmsg+0x8ae/0xd70 net/netlink/af_netlink.c:1926
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xd7/0x130 net/socket.c:671
 ___sys_sendmsg+0x803/0x920 net/socket.c:2292
 __sys_sendmsg+0x105/0x1d0 net/socket.c:2330
 __do_sys_sendmsg net/socket.c:2339 [inline]
 __se_sys_sendmsg net/socket.c:2337 [inline]
 __x64_sys_sendmsg+0x78/0xb0 net/socket.c:2337
 do_syscall_64+0xfd/0x680 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440219
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffe14865258 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440219
RDX: 0000000000000000 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401aa0
R13: 0000000000401b30 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace d3ba55cbfe9f9d8c ]---
RIP: 0010:task_pid_nr include/linux/sched.h:1240 [inline]
RIP: 0010:spin_dump.cold+0xa2/0xe6 kernel/locking/spinlock_debug.c:65
Code: 4e 4d 02 00 e8 c5 52 bd 05 58 5b 41 5c 41 5d 41 5e 5d c3 48 8d bb d0 04 00 00 b8 ff ff 37 00 48 89 fa 48 c1 e0 2a 48 c1 ea 03 <0f> b6 04 02 84 c0 74 04 3c 03 7e 24 44 8b ab d0 04 00 00 48 81 c3
RSP: 0018:ffff88808e767538 EFLAGS: 00010203
RAX: dffffc0000000000 RBX: 000000000ab1cf7e RCX: 0000000000000000
RDX: 0000000001563a89 RSI: ffffffff815ac7e6 RDI: 000000000ab1d44e
RBP: ffff88808e767560 R08: 0000000000000036 R09: ffffed1015d06011
R10: ffffed1015d06010 R11: ffff8880ae830087 R12: ffff88821661b4a8
R13: ffff8880a7748600 R14: ffff88821661a280 R15: ffff88808e7675d8
FS:  0000555555c99880(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000040 CR3: 000000009b9e6000 CR4: 00000000001406f0

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/05/21 23:29 upstream 5bdd9ad875b6 13427bd9 .config console log report syz C ci-upstream-kasan-gce
2019/05/21 20:54 upstream 5bdd9ad875b6 13427bd9 .config console log report syz C ci-upstream-kasan-gce
2019/05/21 02:23 upstream f49aa1de9836 8285069f .config console log report syz C ci-upstream-kasan-gce-smack-root
2019/05/17 02:26 net-old 510e2ceda031 7fb690f3 .config console log report syz C ci-upstream-net-this-kasan-gce
2019/05/20 22:55 net-next-old f49aa1de9836 8285069f .config console log report syz C ci-upstream-net-kasan-gce
2019/05/21 18:04 upstream 5bdd9ad875b6 13427bd9 .config console log report ci-upstream-kasan-gce-386
2019/05/22 04:12 bpf-next f49aa1de9836 13427bd9 .config console log report ci-upstream-bpf-next-kasan-gce
2019/05/17 14:21 linux-next b1d6682ef9bb 95dfd515 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.