syzbot


KMSAN: use-after-free in __skb_try_recv_from_queue

Status: fixed on 2019/12/13 00:31
Subsystems: net
[Documentation on labels]
Fix commit: cf94da6f502d Bluetooth: Fix invalid-free in bcsp_close()
First crash: 1876d, last: 1852d

Sample crash report:
=====================================================
BUG: KMSAN: use-after-free in __skb_unlink include/linux/skbuff.h:2010 [inline]
BUG: KMSAN: use-after-free in __skb_try_recv_from_queue+0x8b1/0xe00 net/core/datagram.c:199
CPU: 1 PID: 5297 Comm: udevd Not tainted 5.4.0-rc5+ #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+0x191/0x1f0 lib/dump_stack.c:113
 kmsan_report+0x128/0x220 mm/kmsan/kmsan_report.c:108
 __msan_warning+0x73/0xe0 mm/kmsan/kmsan_instr.c:245
 __skb_unlink include/linux/skbuff.h:2010 [inline]
 __skb_try_recv_from_queue+0x8b1/0xe00 net/core/datagram.c:199
 __skb_try_recv_datagram+0x2bd/0x6b0 net/core/datagram.c:269
 __skb_recv_datagram net/core/datagram.c:302 [inline]
 skb_recv_datagram+0x227/0x450 net/core/datagram.c:321
 netlink_recvmsg+0x178/0x18e0 net/netlink/af_netlink.c:1940
 sock_recvmsg_nosec net/socket.c:871 [inline]
 sock_recvmsg+0x3b3/0x3c0 net/socket.c:889
 ___sys_recvmsg+0x461/0x11e0 net/socket.c:2480
 __sys_recvmsg net/socket.c:2537 [inline]
 __do_sys_recvmsg net/socket.c:2547 [inline]
 __se_sys_recvmsg+0x2fa/0x450 net/socket.c:2544
 __x64_sys_recvmsg+0x4a/0x70 net/socket.c:2544
 do_syscall_64+0xb6/0x160 arch/x86/entry/common.c:291
 entry_SYSCALL_64_after_hwframe+0x63/0xe7
RIP: 0033:0x7fa7f61d3210
Code: 31 d2 48 29 c2 64 89 11 48 83 c8 ff eb ea 90 90 90 90 90 90 90 90 90 90 90 90 83 3d e5 d3 2a 00 00 75 10 b8 2f 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 6e bb 00 00 48 89 04 24
RSP: 002b:00007fff06a24628 EFLAGS: 00000246 ORIG_RAX: 000000000000002f
RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fa7f61d3210
RDX: 0000000000000000 RSI: 00007fff06a24690 RDI: 0000000000000004
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000001
R10: 0000000000000008 R11: 0000000000000246 R12: 00007fff06a246f0
R13: 0000000000000000 R14: 0000000000def2d0 R15: 0000000000def250

Uninit was created at:
 kmsan_save_stack_with_flags mm/kmsan/kmsan.c:151 [inline]
 kmsan_internal_poison_shadow+0x60/0x120 mm/kmsan/kmsan.c:134
 kmsan_slab_free+0x8d/0xf0 mm/kmsan/kmsan_hooks.c:108
 slab_free_freelist_hook mm/slub.c:1473 [inline]
 slab_free mm/slub.c:3046 [inline]
 kmem_cache_free+0x2d1/0x2b70 mm/slub.c:3062
 kfree_skbmem net/core/skbuff.c:644 [inline]
 __kfree_skb net/core/skbuff.c:680 [inline]
 kfree_skb+0x473/0x4c0 net/core/skbuff.c:697
 bcsp_close+0x127/0x1e0 drivers/bluetooth/hci_bcsp.c:748
 hci_uart_tty_close+0x385/0x410 drivers/bluetooth/hci_ldisc.c:548
 tty_ldisc_close drivers/tty/tty_ldisc.c:494 [inline]
 tty_ldisc_kill drivers/tty/tty_ldisc.c:642 [inline]
 tty_ldisc_release+0x5dd/0xd50 drivers/tty/tty_ldisc.c:814
 tty_release_struct+0x4f/0x1d0 drivers/tty/tty_io.c:1612
 tty_release+0x1be2/0x1e80 drivers/tty/tty_io.c:1785
 __fput+0x4c9/0xba0 fs/file_table.c:280
 ____fput+0x37/0x40 fs/file_table.c:313
 task_work_run+0x22e/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0xef9/0x3a70 kernel/exit.c:819
 do_group_exit+0x18a/0x320 kernel/exit.c:923
 get_signal+0xbf6/0x32f0 kernel/signal.c:2734
 do_signal+0x6f/0xe10 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline]
 prepare_exit_to_usermode+0x2c5/0x4d0 arch/x86/entry/common.c:194
 syscall_return_slowpath+0x90/0x610 arch/x86/entry/common.c:274
 do_syscall_64+0xdc/0x160 arch/x86/entry/common.c:301
 entry_SYSCALL_64_after_hwframe+0x63/0xe7
=====================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/14 07:49 https://github.com/google/kmsan.git master 9c6a71628ab9 048f2d49 .config console log report syz C ci-upstream-kmsan-gce
2019/10/31 10:38 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/10/30 09:42 https://github.com/google/kmsan.git master 96c6c3194b1b 5ea87a66 .config console log report ci-upstream-kmsan-gce
2019/10/21 13:21 https://github.com/google/kmsan.git master 3c8ca70889aa b24d2b8a .config console log report ci-upstream-kmsan-gce
* Struck through repros no longer work on HEAD.