syzbot


KASAN: use-after-free Read in hci_cmd_timeout

Status: auto-obsoleted due to no activity on 2023/05/29 20:38
Reported-by: syzbot+d0849c311341c714c85e@syzkaller.appspotmail.com
First crash: 421d, last: 421d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in hci_cmd_timeout syz error 17 450d 1698d 0/1 upstream: reported syz repro on 2019/09/01 02:37
linux-4.14 KASAN: use-after-free Read in hci_cmd_timeout C inconclusive 11 828d 1692d 0/1 upstream: reported C repro on 2019/09/06 20:31
upstream KASAN: use-after-free Read in hci_cmd_timeout C done error 371 502d 1814d 22/26 fixed on 2023/04/12 21:18
upstream KASAN: slab-use-after-free Read in hci_cmd_timeout bluetooth 2 22d 39d 0/26 upstream: reported on 2024/03/16 12:17

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in hci_cmd_timeout+0x1d6/0x200 net/bluetooth/hci_core.c:2763
Read of size 2 at addr ffff88810e131008 by task kworker/1:5/662

CPU: 1 PID: 662 Comm: kworker/1:5 Not tainted 5.10.161-syzkaller-00019-g416c4356f372 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/16/2023
Workqueue: events hci_cmd_timeout
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118
 print_address_description+0x81/0x3c0 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report+0x1a4/0x1f0 mm/kasan/report.c:436
 __asan_report_load_n_noabort+0xf/0x20 mm/kasan/report_generic.c:319
 hci_cmd_timeout+0x1d6/0x200 net/bluetooth/hci_core.c:2763
 process_one_work+0x726/0xc10 kernel/workqueue.c:2296
 worker_thread+0xb27/0x1550 kernel/workqueue.c:2442
 kthread+0x349/0x3d0 kernel/kthread.c:313
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:299

Allocated by task 0:
(stack is not available)

The buggy address belongs to the object at ffff88810e131000
 which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
 512-byte region [ffff88810e131000, ffff88810e131200)
The buggy address belongs to the page:
page:ffffea0004384c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10e130
head:ffffea0004384c00 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x8000000000010200(slab|head)
raw: 8000000000010200 dead000000000100 dead000000000122 ffff888100043080
raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 384, ts 155620639280, free_ts 155620556139
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2386 [inline]
 prep_new_page mm/page_alloc.c:2392 [inline]
 get_page_from_freelist+0x755/0x810 mm/page_alloc.c:4073
 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5160
 alloc_slab_page mm/slub.c:1815 [inline]
 allocate_slab+0x78/0x540 mm/slub.c:1817
 new_slab mm/slub.c:1878 [inline]
 new_slab_objects mm/slub.c:2636 [inline]
 ___slab_alloc+0x131/0x2e0 mm/slub.c:2800
 __slab_alloc+0x63/0xa0 mm/slub.c:2840
 slab_alloc_node mm/slub.c:2922 [inline]
 slab_alloc mm/slub.c:2964 [inline]
 __kmalloc_track_caller+0x23e/0x350 mm/slub.c:4545
 __kmalloc_reserve net/core/skbuff.c:143 [inline]
 __alloc_skb+0xbe/0x580 net/core/skbuff.c:211
 alloc_skb include/linux/skbuff.h:1116 [inline]
 nlmsg_new include/net/netlink.h:953 [inline]
 rtmsg_ifa+0x1e0/0x390 net/ipv4/devinet.c:1900
 __inet_insert_ifa+0x8c6/0xb20 net/ipv4/devinet.c:552
 inet_insert_ifa net/ipv4/devinet.c:560 [inline]
 inetdev_event+0xc2b/0x1090 net/ipv4/devinet.c:1571
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0x9e/0x110 kernel/notifier.c:410
 __dev_notify_flags+0x2ef/0x5f0 net/core/dev.c:2054
 dev_change_flags+0xec/0x190 net/core/dev.c:8573
 do_setlink+0xc3e/0x3b50 net/core/rtnetlink.c:2709
 __rtnl_newlink net/core/rtnetlink.c:3379 [inline]
 rtnl_newlink+0x166a/0x1ff0 net/core/rtnetlink.c:3494
 rtnetlink_rcv_msg+0x95a/0xc60 net/core/rtnetlink.c:5571
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1332 [inline]
 __free_pages_ok+0x7f8/0x830 mm/page_alloc.c:1612
 free_the_page mm/page_alloc.c:5221 [inline]
 __free_pages+0x383/0x570 mm/page_alloc.c:5228
 __free_slab+0xd3/0x190 mm/slub.c:1903
 free_slab mm/slub.c:1918 [inline]
 discard_slab+0x29/0x40 mm/slub.c:1924
 __slab_free+0x31d/0x3a0 mm/slub.c:3140
 do_slab_free mm/slub.c:3200 [inline]
 ___cache_free+0x11f/0x140 mm/slub.c:3219
 qlink_free+0x38/0x40 mm/kasan/quarantine.c:146
 qlist_free_all+0x4c/0xc0 mm/kasan/quarantine.c:165
 kasan_quarantine_reduce+0x15a/0x170 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:438
 kasan_slab_alloc include/linux/kasan.h:259 [inline]
 slab_post_alloc_hook include/../mm/slab.h:583 [inline]
 slab_alloc_node mm/slub.c:2956 [inline]
 slab_alloc mm/slub.c:2964 [inline]
 kmem_cache_alloc+0x16c/0x300 mm/slub.c:2969
 kmem_cache_alloc_node include/linux/slab.h:423 [inline]
 __alloc_skb+0x7e/0x580 net/core/skbuff.c:199
 alloc_skb include/linux/skbuff.h:1116 [inline]
 netlink_alloc_large_skb net/netlink/af_netlink.c:1185 [inline]
 netlink_sendmsg+0x7a4/0xd00 net/netlink/af_netlink.c:1909
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg net/socket.c:672 [inline]
 __sys_sendto+0x541/0x700 net/socket.c:1982
 __do_sys_sendto net/socket.c:1994 [inline]
 __se_sys_sendto net/socket.c:1990 [inline]
 __x64_sys_sendto+0xe5/0x100 net/socket.c:1990
 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46

Memory state around the buggy address:
 ffff88810e130f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88810e130f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88810e131000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                      ^
 ffff88810e131080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88810e131100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
Bluetooth: hci0: command 0x0233 tx timeout

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/28 20:35 android12-5.10-lts 416c4356f372 95aee97a .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in hci_cmd_timeout
* Struck through repros no longer work on HEAD.