syzbot


KASAN: use-after-free Read in h5_rx_3wire_hdr (2)

Status: auto-closed as invalid on 2021/10/29 20:15
Reported-by: syzbot+4adb718f82e7b09204fb@syzkaller.appspotmail.com
First crash: 1251d, last: 1251d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in h5_rx_3wire_hdr bluetooth syz error 3 1195d 1961d 0/28 auto-obsoleted due to no activity on 2023/04/15 21:58
linux-4.14 KASAN: use-after-free Read in h5_rx_3wire_hdr syz inconclusive 2 1634d 1964d 0/1 upstream: reported syz repro on 2019/07/20 02:11
linux-4.19 KASAN: use-after-free Read in h5_rx_3wire_hdr 2 1698d 1740d 0/1 auto-closed as invalid on 2020/08/08 17:48

Sample crash report:
Bluetooth: Invalid header checksum
Bluetooth: Invalid header checksum
Bluetooth: Invalid header checksum
Bluetooth: Invalid header checksum
==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:43 [inline]
BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:967 [inline]
BUG: KASAN: use-after-free in kfree_skb+0x32/0x3d0 net/core/skbuff.c:668
Read of size 4 at addr ffff88809e42d9a4 by task kworker/u4:2/43

CPU: 1 PID: 43 Comm: kworker/u4:2 Not tainted 4.19.196-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
 kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
 kasan_report+0x8f/0xa0 mm/kasan/report.c:412
 atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
 refcount_read include/linux/refcount.h:43 [inline]
 skb_unref include/linux/skbuff.h:967 [inline]
 kfree_skb+0x32/0x3d0 net/core/skbuff.c:668
 h5_reset_rx drivers/bluetooth/hci_h5.c:546 [inline]
 h5_rx_3wire_hdr+0x43a/0x7f0 drivers/bluetooth/hci_h5.c:456
 h5_recv+0x370/0x6c0 drivers/bluetooth/hci_h5.c:579
 hci_uart_tty_receive+0x221/0x530 drivers/bluetooth/hci_ldisc.c:621
 tty_ldisc_receive_buf+0x14a/0x190 drivers/tty/tty_buffer.c:460
 tty_port_default_receive_buf+0x78/0xa0 drivers/tty/tty_port.c:38
 receive_buf drivers/tty/tty_buffer.c:476 [inline]
 flush_to_ldisc+0x21f/0x390 drivers/tty/tty_buffer.c:528
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Allocated by task 43:
 kmem_cache_alloc_node+0x146/0x3b0 mm/slab.c:3649
 __alloc_skb+0x71/0x560 net/core/skbuff.c:193
 alloc_skb include/linux/skbuff.h:995 [inline]
 bt_skb_alloc include/net/bluetooth/bluetooth.h:339 [inline]
 h5_rx_pkt_start+0xd1/0x360 drivers/bluetooth/hci_h5.c:490
 h5_recv+0x370/0x6c0 drivers/bluetooth/hci_h5.c:579
 hci_uart_tty_receive+0x221/0x530 drivers/bluetooth/hci_ldisc.c:621
 tty_ldisc_receive_buf+0x14a/0x190 drivers/tty/tty_buffer.c:460
 tty_port_default_receive_buf+0x78/0xa0 drivers/tty/tty_port.c:38
 receive_buf drivers/tty/tty_buffer.c:476 [inline]
 flush_to_ldisc+0x21f/0x390 drivers/tty/tty_buffer.c:528
 process_one_work+0x864/0x1570 kernel/workqueue.c:2153
 worker_thread+0x64c/0x1130 kernel/workqueue.c:2296
 kthread+0x33f/0x460 kernel/kthread.c:259
 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415

Freed by task 6016:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 kfree_skbmem+0xc1/0x140 net/core/skbuff.c:595
 __kfree_skb net/core/skbuff.c:655 [inline]
 kfree_skb+0x127/0x3d0 net/core/skbuff.c:672
 h5_reset_rx drivers/bluetooth/hci_h5.c:546 [inline]
 h5_rx_3wire_hdr+0x43a/0x7f0 drivers/bluetooth/hci_h5.c:456
 h5_recv+0x370/0x6c0 drivers/bluetooth/hci_h5.c:579
 hci_uart_tty_receive+0x221/0x530 drivers/bluetooth/hci_ldisc.c:621
 tiocsti drivers/tty/tty_io.c:2194 [inline]
 tty_ioctl+0xff8/0x15c0 drivers/tty/tty_io.c:2580
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88809e42d8c0
 which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 228 bytes inside of
 232-byte region [ffff88809e42d8c0, ffff88809e42d9a8)
The buggy address belongs to the page:
page:ffffea0002790b40 count:1 mapcount:0 mapping:ffff8880b5b96900 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffffea0002921648 ffffea0002a87788 ffff8880b5b96900
raw: 0000000000000000 ffff88809e42d000 000000010000000c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809e42d880: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
 ffff88809e42d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88809e42d980: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
                               ^
 ffff88809e42da00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88809e42da80: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
==================================================================
Bluetooth: Invalid header checksum
Bluetooth: Invalid header checksum
Bluetooth: Invalid header checksum
Bluetooth: Invalid header checksum
audit: type=1804 audit(1625170492.557:991): pid=6030 uid=0 auid=4294967295 ses=4294967295 subj==unconfined op=invalid_pcr cause=open_writers comm="syz-executor.3" name="/root/syzkaller-testdir549825595/syzkaller.GMLeDz/2801/bus" dev="sda1" ino=14312 res=1

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/07/01 20:15 linux-4.19.y 9f84340f012e 658ebc66 .config console log report info ci2-linux-4-19 KASAN: use-after-free Read in h5_rx_3wire_hdr
* Struck through repros no longer work on HEAD.