syzbot


KASAN: use-after-free Read in bt_accept_unlink

Status: upstream: reported on 2025/06/10 23:51
Reported-by: syzbot+e6b4845cb15e1a8207ac@syzkaller.appspotmail.com
First crash: 7d11h, last: 7d11h
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Read in bt_accept_unlink bluetooth 46 1h21m 240d 0/28 upstream: reported on 2024/10/21 08:47
linux-5.15 BUG: corrupted list in bt_accept_unlink 3 29d 70d 0/3 upstream: reported on 2025/04/09 00:51
linux-6.6 KASAN: slab-out-of-bounds Read in bt_accept_unlink 1 1d11h 1d11h 0/2 upstream: reported on 2025/06/17 00:09
upstream general protection fault in bt_accept_unlink (2) bluetooth 1 1568d 1564d 0/28 auto-closed as invalid on 2021/07/01 06:33

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x80/0x120 lib/list_debug.c:59
Read of size 8 at addr ffff88807b0ac510 by task syz.1.56/4627

CPU: 0 PID: 4627 Comm: syz.1.56 Not tainted 6.1.141-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x22e lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0xa8/0x220 mm/kasan/report.c:427
 kasan_report+0x10b/0x140 mm/kasan/report.c:531
 __list_del_entry_valid+0x80/0x120 lib/list_debug.c:59
 __list_del_entry include/linux/list.h:134 [inline]
 list_del_init include/linux/list.h:206 [inline]
 bt_accept_unlink+0x35/0x230 net/bluetooth/af_bluetooth.c:232
 l2cap_sock_teardown_cb+0x1af/0x380 net/bluetooth/l2cap_sock.c:1633
 l2cap_chan_del+0xab/0x620 net/bluetooth/l2cap_core.c:679
 l2cap_conn_del+0x3c4/0x6a0 net/bluetooth/l2cap_core.c:1954
 hci_disconn_cfm include/net/bluetooth/hci_core.h:1802 [inline]
 hci_conn_hash_flush+0x113/0x290 net/bluetooth/hci_conn.c:2503
 hci_dev_close_sync+0x930/0xf40 net/bluetooth/hci_sync.c:5178
 hci_dev_do_close net/bluetooth/hci_core.c:510 [inline]
 hci_rfkill_set_block+0x127/0x1f0 net/bluetooth/hci_core.c:917
 rfkill_set_block+0x1c6/0x420 net/rfkill/core.c:345
 rfkill_fop_write+0x458/0x560 net/rfkill/core.c:1286
 vfs_write+0x2c4/0x960 fs/read_write.c:582
 ksys_write+0x143/0x240 fs/read_write.c:637
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7f042198e929
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f04228a0038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f0421bb5fa0 RCX: 00007f042198e929
RDX: 0000000000000008 RSI: 0000200000000300 RDI: 0000000000000006
RBP: 00007f0421a10b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f0421bb5fa0 R15: 00007fffe6f71178
 </TASK>

Allocated by task 11:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x8e/0xa0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:936 [inline]
 __kmalloc_node_track_caller+0xae/0x230 mm/slab_common.c:956
 kmalloc_reserve net/core/skbuff.c:446 [inline]
 __alloc_skb+0x22a/0x7e0 net/core/skbuff.c:515
 alloc_skb include/linux/skbuff.h:1271 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline]
 nsim_dev_trap_report_work+0x28f/0xaf0 drivers/net/netdevsim/dev.c:851
 process_one_work+0x898/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaa2/0x1250 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 11:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x2d/0x50 mm/kasan/generic.c:516
 ____kasan_slab_free+0x126/0x1e0 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook+0x131/0x1a0 mm/slub.c:1750
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0xb6/0x1f0 mm/slub.c:3674
 skb_free_head net/core/skbuff.c:762 [inline]
 skb_release_data+0x5db/0x7c0 net/core/skbuff.c:791
 skb_release_all net/core/skbuff.c:856 [inline]
 __kfree_skb net/core/skbuff.c:870 [inline]
 consume_skb+0xa2/0x100 net/core/skbuff.c:1035
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:821 [inline]
 nsim_dev_trap_report_work+0x76b/0xaf0 drivers/net/netdevsim/dev.c:851
 process_one_work+0x898/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaa2/0x1250 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88807b0ac000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 1296 bytes inside of
 4096-byte region [ffff88807b0ac000, ffff88807b0ad000)

The buggy address belongs to the physical page:
page:ffffea0001ec2a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7b0a8
head:ffffea0001ec2a00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888017442140
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 4351, tgid 4351 (kworker/u4:8), ts 126228467382, free_ts 126212432002
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x173/0x1a0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x1a26/0x1ac0 mm/page_alloc.c:4328
 __alloc_pages+0x1df/0x4e0 mm/page_alloc.c:5614
 alloc_slab_page+0x5d/0x160 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x87/0x2c0 mm/slub.c:1992
 ___slab_alloc+0xbc6/0x1220 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x1a0/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc_node_track_caller+0x9e/0x230 mm/slab_common.c:956
 kmalloc_reserve net/core/skbuff.c:446 [inline]
 __alloc_skb+0x22a/0x7e0 net/core/skbuff.c:515
 alloc_skb include/linux/skbuff.h:1271 [inline]
 nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:748 [inline]
 nsim_dev_trap_report drivers/net/netdevsim/dev.c:805 [inline]
 nsim_dev_trap_report_work+0x28f/0xaf0 drivers/net/netdevsim/dev.c:851
 process_one_work+0x898/0x1160 kernel/workqueue.c:2292
 worker_thread+0xaa2/0x1250 kernel/workqueue.c:2439
 kthread+0x29d/0x330 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x8b4/0x9a0 mm/page_alloc.c:3384
 free_unref_page+0x2e/0x3f0 mm/page_alloc.c:3479
 qlink_free mm/kasan/quarantine.c:168 [inline]
 qlist_free_all+0x76/0xe0 mm/kasan/quarantine.c:187
 kasan_quarantine_reduce+0x144/0x160 mm/kasan/quarantine.c:294
 __kasan_slab_alloc+0x1e/0x80 mm/kasan/common.c:305
 kasan_slab_alloc include/linux/kasan.h:201 [inline]
 slab_post_alloc_hook+0x4b/0x480 mm/slab.h:737
 slab_alloc_node mm/slub.c:3398 [inline]
 __kmem_cache_alloc_node+0x140/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc+0xa0/0x240 mm/slab_common.c:949
 kmalloc include/linux/slab.h:568 [inline]
 kzalloc include/linux/slab.h:699 [inline]
 tomoyo_encode2 security/tomoyo/realpath.c:45 [inline]
 tomoyo_encode+0x27e/0x540 security/tomoyo/realpath.c:80
 tomoyo_realpath_from_path+0x58e/0x5d0 security/tomoyo/realpath.c:283
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x1fd/0x550 security/tomoyo/file.c:822
 security_inode_getattr+0xcf/0x120 security/security.c:1361
 vfs_getattr+0x26/0x3a0 fs/stat.c:158
 vfs_statx+0x16e/0x650 fs/stat.c:233
 vfs_fstatat fs/stat.c:267 [inline]
 __do_sys_newfstatat fs/stat.c:437 [inline]
 __se_sys_newfstatat fs/stat.c:431 [inline]
 __x64_sys_newfstatat+0x155/0x1e0 fs/stat.c:431
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81

Memory state around the buggy address:
 ffff88807b0ac400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807b0ac480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88807b0ac500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                         ^
 ffff88807b0ac580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88807b0ac600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/06/10 23:50 linux-6.1.y 58485ff1a74f 5d7e17ca .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in bt_accept_unlink
* Struck through repros no longer work on HEAD.