syzbot


KMSAN: use-after-free in kfree_skb

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

Sample crash report:
=====================================================
BUG: KMSAN: use-after-free in skb_unref include/linux/skbuff.h:1011 [inline]
BUG: KMSAN: use-after-free in kfree_skb+0x23c/0x4c0 net/core/skbuff.c:693
CPU: 0 PID: 12793 Comm: syz-executor.1 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_unref include/linux/skbuff.h:1011 [inline]
 kfree_skb+0x23c/0x4c0 net/core/skbuff.c:693
 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
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop arch/x86/entry/common.c:163 [inline]
 prepare_exit_to_usermode+0x39d/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
RIP: 0033:0x4141b0
Code: 01 f0 ff ff 0f 83 30 1b 00 00 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 83 3d bd 42 66 00 00 75 14 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff
RSP: 002b:00007ffc6ea1bbf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00000000004141b0
RDX: 0000001b2cd20000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000001 R08: 0000000000000009 R09: ffffffffffffffff
R10: ffffffffffffffff R11: 0000000000000246 R12: 000000000075bf20
R13: 0000000000000003 R14: 0000000000762a58 R15: 000000000075bf2c

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
 ip6_mc_input+0xec9/0x1470 net/ipv6/ip6_input.c:556
 dst_input include/net/dst.h:442 [inline]
 ip6_rcv_finish net/ipv6/ip6_input.c:76 [inline]
 NF_HOOK include/linux/netfilter.h:305 [inline]
 ipv6_rcv+0x683/0x710 net/ipv6/ip6_input.c:284
 __netif_receive_skb_one_core net/core/dev.c:5010 [inline]
 __netif_receive_skb net/core/dev.c:5124 [inline]
 process_backlog+0x721/0x1410 net/core/dev.c:5955
 napi_poll net/core/dev.c:6392 [inline]
 net_rx_action+0x7a6/0x1aa0 net/core/dev.c:6460
 __do_softirq+0x4a1/0x83a kernel/softirq.c:293
 run_ksoftirqd+0x25/0x40 kernel/softirq.c:607
 smpboot_thread_fn+0x4a3/0x990 kernel/smpboot.c:165
 kthread+0x4b5/0x4f0 kernel/kthread.c:256
 ret_from_fork+0x35/0x40 arch/x86/entry/entry_64.S:355
=====================================================

Crashes (34):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/20 11:10 https://github.com/google/kmsan.git master 9c6a71628ab9 f4b7ed07 .config console log report syz ci-upstream-kmsan-gce
2019/11/12 05:25 https://github.com/google/kmsan.git master e741088f2efa 048f2d49 .config console log report syz ci-upstream-kmsan-gce
2019/11/01 08:55 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report syz ci-upstream-kmsan-gce
2019/10/31 09:12 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report syz ci-upstream-kmsan-gce
2019/10/29 02:19 https://github.com/google/kmsan.git master 96c6c3194b1b 439d7b14 .config console log report syz ci-upstream-kmsan-gce
2019/10/19 12:34 https://github.com/google/kmsan.git master 3c8ca70889aa 8c88c9c1 .config console log report syz ci-upstream-kmsan-gce
2019/10/17 09:31 https://github.com/google/kmsan.git master c24534505750 8c88c9c1 .config console log report syz ci-upstream-kmsan-gce
2019/11/26 00:29 https://github.com/google/kmsan.git master 4a1d41e39c62 f746151a .config console log report ci-upstream-kmsan-gce
2019/11/25 05:02 https://github.com/google/kmsan.git master 4a1d41e39c62 598ca6c8 .config console log report ci-upstream-kmsan-gce
2019/11/24 22:01 https://github.com/google/kmsan.git master 4a1d41e39c62 598ca6c8 .config console log report ci-upstream-kmsan-gce
2019/11/24 06:44 https://github.com/google/kmsan.git master 4a1d41e39c62 598ca6c8 .config console log report ci-upstream-kmsan-gce
2019/11/23 21:58 https://github.com/google/kmsan.git master 4a1d41e39c62 598ca6c8 .config console log report ci-upstream-kmsan-gce
2019/11/16 07:58 https://github.com/google/kmsan.git master 9c6a71628ab9 cdac920b .config console log report ci-upstream-kmsan-gce
2019/11/12 13:53 https://github.com/google/kmsan.git master e741088f2efa 048f2d49 .config console log report ci-upstream-kmsan-gce
2019/11/11 04:23 https://github.com/google/kmsan.git master e741088f2efa dc438b91 .config console log report ci-upstream-kmsan-gce
2019/11/10 23:31 https://github.com/google/kmsan.git master e741088f2efa dc438b91 .config console log report ci-upstream-kmsan-gce
2019/11/09 23:40 https://github.com/google/kmsan.git master e741088f2efa dc438b91 .config console log report ci-upstream-kmsan-gce
2019/11/09 18:31 https://github.com/google/kmsan.git master e741088f2efa dc438b91 .config console log report ci-upstream-kmsan-gce
2019/11/08 14:03 https://github.com/google/kmsan.git master e741088f2efa 1e35461e .config console log report ci-upstream-kmsan-gce
2019/11/03 01:32 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/11/01 15:00 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/11/01 14:30 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/11/01 07:30 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/11/01 04:56 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/10/31 22:27 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/10/31 07:46 https://github.com/google/kmsan.git master 6f88939b3fa3 a41ca8fa .config console log report ci-upstream-kmsan-gce
2019/10/30 08:31 https://github.com/google/kmsan.git master 96c6c3194b1b 5ea87a66 .config console log report ci-upstream-kmsan-gce
2019/10/29 01:16 https://github.com/google/kmsan.git master 96c6c3194b1b 439d7b14 .config console log report ci-upstream-kmsan-gce
2019/10/28 15:31 https://github.com/google/kmsan.git master d86c15562d02 25bb509e .config console log report ci-upstream-kmsan-gce
2019/10/23 10:15 https://github.com/google/kmsan.git master 3c8ca70889aa d0686497 .config console log report ci-upstream-kmsan-gce
2019/10/22 16:29 https://github.com/google/kmsan.git master 3c8ca70889aa 5681358a .config console log report ci-upstream-kmsan-gce
2019/10/19 10:47 https://github.com/google/kmsan.git master 3c8ca70889aa 8c88c9c1 .config console log report ci-upstream-kmsan-gce
2019/10/13 23:31 https://github.com/google/kmsan.git master fa1690255288 2f661ec4 .config console log report ci-upstream-kmsan-gce
2019/10/08 19:59 https://github.com/google/kmsan.git master cebb918b7474 b1ebbfef .config console log report ci-upstream-kmsan-gce
* Struck through repros no longer work on HEAD.