syzbot


KASAN: use-after-free Write in sco_conn_del

Status: auto-closed as invalid on 2022/06/29 18:22
Reported-by: syzbot+ba12d3e3c460f3c1d1e0@syzkaller.appspotmail.com
First crash: 442d, last: 269d
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in sco_conn_del 10 356d 426d 0/1 auto-closed as invalid on 2022/04/03 17:14
linux-4.19 KASAN: use-after-free Read in sco_conn_del (2) 1 32d 32d 0/1 upstream: reported on 2022/10/24 22:38

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline]
BUG: KASAN: use-after-free in __refcount_add include/linux/refcount.h:193 [inline]
BUG: KASAN: use-after-free in __refcount_inc include/linux/refcount.h:250 [inline]
BUG: KASAN: use-after-free in refcount_inc include/linux/refcount.h:267 [inline]
BUG: KASAN: use-after-free in sock_hold include/net/sock.h:712 [inline]
BUG: KASAN: use-after-free in sco_conn_del+0xac/0x2f0 net/bluetooth/sco.c:193
Write of size 4 at addr ffff8880770b3080 by task syz-executor.2/7004

CPU: 1 PID: 7004 Comm: syz-executor.2 Not tainted 5.17.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1dc/0x2d8 lib/dump_stack.c:106
 print_address_description+0x65/0x3a0 mm/kasan/report.c:255
 __kasan_report mm/kasan/report.c:442 [inline]
 kasan_report+0x19a/0x1f0 mm/kasan/report.c:459
 kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_fetch_add_relaxed include/linux/atomic/atomic-instrumented.h:116 [inline]
 __refcount_add include/linux/refcount.h:193 [inline]
 __refcount_inc include/linux/refcount.h:250 [inline]
 refcount_inc include/linux/refcount.h:267 [inline]
 sock_hold include/net/sock.h:712 [inline]
 sco_conn_del+0xac/0x2f0 net/bluetooth/sco.c:193
 hci_disconn_cfm include/net/bluetooth/hci_core.h:1556 [inline]
 hci_conn_hash_flush+0x112/0x240 net/bluetooth/hci_conn.c:1455
 hci_dev_close_sync+0x742/0xd20 net/bluetooth/hci_sync.c:4108
 hci_dev_do_close net/bluetooth/hci_core.c:553 [inline]
 hci_unregister_dev+0x1be/0x470 net/bluetooth/hci_core.c:2686
 vhci_release+0x7f/0xd0 drivers/bluetooth/hci_vhci.c:568
 __fput+0x3fc/0x870 fs/file_table.c:311
 task_work_run+0x146/0x1c0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0x63b/0x2140 kernel/exit.c:806
 do_group_exit+0x2af/0x2b0 kernel/exit.c:935
 __do_sys_exit_group+0x13/0x20 kernel/exit.c:946
 __se_sys_exit_group+0x10/0x10 kernel/exit.c:944
 __x64_sys_exit_group+0x37/0x40 kernel/exit.c:944
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f3177eb8059
Code: Unable to access opcode bytes at RIP 0x7f3177eb802f.
RSP: 002b:00007ffe2061f598 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 0000000000000064 RCX: 00007f3177eb8059
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 00007f3177f1125c R08: 000000000000000c R09: 00005555559103b8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000016
R13: 00007ffe20620870 R14: 00005555559103b8 R15: 00007ffe20621970
 </TASK>

Allocated by task 21208:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:436 [inline]
 ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:515
 kasan_kmalloc include/linux/kasan.h:270 [inline]
 __kmalloc+0x253/0x380 mm/slub.c:4424
 kmalloc include/linux/slab.h:586 [inline]
 sk_prot_alloc+0xf4/0x230 net/core/sock.c:1923
 sk_alloc+0x36/0x340 net/core/sock.c:1976
 sco_sock_alloc net/bluetooth/sco.c:483 [inline]
 sco_sock_create+0xb0/0x450 net/bluetooth/sco.c:522
 bt_sock_create+0x15b/0x220 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x580/0x8d0 net/socket.c:1468
 sock_create net/socket.c:1519 [inline]
 __sys_socket+0x133/0x380 net/socket.c:1561
 __do_sys_socket net/socket.c:1570 [inline]
 __se_sys_socket net/socket.c:1568 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Freed by task 21231:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4c/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x180 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:236 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1754
 slab_free mm/slub.c:3509 [inline]
 kfree+0xb8/0x2e0 mm/slub.c:4562
 sk_prot_free net/core/sock.c:1959 [inline]
 __sk_destruct+0x453/0x5e0 net/core/sock.c:2045
 sco_sock_release+0x24c/0x330 net/bluetooth/sco.c:1259
 __sock_release net/socket.c:650 [inline]
 sock_close+0xd8/0x260 net/socket.c:1318
 __fput+0x3fc/0x870 fs/file_table.c:311
 task_work_run+0x146/0x1c0 kernel/task_work.c:164
 get_signal+0x2286/0x2330 kernel/signal.c:2630
 arch_do_signal_or_restart+0x9c/0x730 arch/x86/kernel/signal.c:868
 handle_signal_work kernel/entry/common.c:148 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
 exit_to_user_mode_prepare+0x191/0x220 kernel/entry/common.c:207
 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
 syscall_exit_to_user_mode+0x2e/0x70 kernel/entry/common.c:300
 do_syscall_64+0x53/0xd0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xb2/0xc0 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3026 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3106
 netlink_release+0x132f/0x17a0 net/netlink/af_netlink.c:813
 __sock_release net/socket.c:650 [inline]
 sock_close+0xd8/0x260 net/socket.c:1318
 __fput+0x3fc/0x870 fs/file_table.c:311
 task_work_run+0x146/0x1c0 kernel/task_work.c:164
 exit_task_work include/linux/task_work.h:32 [inline]
 do_exit+0x63b/0x2140 kernel/exit.c:806
 do_group_exit+0x2af/0x2b0 kernel/exit.c:935
 __do_sys_exit_group+0x13/0x20 kernel/exit.c:946
 __ia32_sys_exit_group+0x0/0x40 kernel/exit.c:944
 __x64_sys_exit_group+0x37/0x40 kernel/exit.c:944
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff8880770b3000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 128 bytes inside of
 2048-byte region [ffff8880770b3000, ffff8880770b3800)
The buggy address belongs to the page:
page:ffffea0001dc2c00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x770b0
head:ffffea0001dc2c00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888011442000
raw: 0000000000000000 0000000000080008 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 20734, ts 597477221750, free_ts 597372532846
 prep_new_page mm/page_alloc.c:2434 [inline]
 get_page_from_freelist+0x729/0x9e0 mm/page_alloc.c:4165
 __alloc_pages+0x255/0x580 mm/page_alloc.c:5389
 alloc_slab_page mm/slub.c:1799 [inline]
 allocate_slab+0xce/0x3f0 mm/slub.c:1944
 new_slab mm/slub.c:2004 [inline]
 ___slab_alloc+0x3fe/0xc30 mm/slub.c:3018
 __slab_alloc mm/slub.c:3105 [inline]
 slab_alloc_node mm/slub.c:3196 [inline]
 slab_alloc mm/slub.c:3238 [inline]
 __kmalloc+0x2eb/0x380 mm/slub.c:4420
 kmalloc include/linux/slab.h:586 [inline]
 sk_prot_alloc+0xf4/0x230 net/core/sock.c:1923
 sk_alloc+0x36/0x340 net/core/sock.c:1976
 __netlink_create+0x68/0x230 net/netlink/af_netlink.c:645
 netlink_create+0x368/0x530 net/netlink/af_netlink.c:708
 __sock_create+0x580/0x8d0 net/socket.c:1468
 sock_create net/socket.c:1519 [inline]
 __sys_socket+0x133/0x380 net/socket.c:1561
 __do_sys_socket net/socket.c:1570 [inline]
 __se_sys_socket net/socket.c:1568 [inline]
 __x64_sys_socket+0x76/0x80 net/socket.c:1568
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1352 [inline]
 free_pcp_prepare+0xd1c/0xe00 mm/page_alloc.c:1404
 free_unref_page_prepare mm/page_alloc.c:3325 [inline]
 free_unref_page+0x7d/0x580 mm/page_alloc.c:3404
 do_slab_free mm/slub.c:3497 [inline]
 ___cache_free+0x107/0x160 mm/slub.c:3516
 qlist_free_all mm/kasan/quarantine.c:176 [inline]
 kasan_quarantine_reduce+0x169/0x1f0 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xe0 mm/kasan/common.c:446
 kasan_slab_alloc include/linux/kasan.h:260 [inline]
 slab_post_alloc_hook mm/slab.h:732 [inline]
 slab_alloc_node mm/slub.c:3230 [inline]
 slab_alloc mm/slub.c:3238 [inline]
 kmem_cache_alloc_trace+0x20b/0x330 mm/slub.c:3255
 kmalloc include/linux/slab.h:581 [inline]
 usb_control_msg+0xb7/0x4b0 drivers/usb/core/message.c:143
 hub_set_address drivers/usb/core/hub.c:4616 [inline]
 hub_port_init+0xcaa/0x2e60 drivers/usb/core/hub.c:4891
 hub_port_connect+0xc30/0x2910 drivers/usb/core/hub.c:5287
 hub_port_connect_change+0x5f9/0xc20 drivers/usb/core/hub.c:5502
 port_event+0xca0/0x13e0 drivers/usb/core/hub.c:5660
 hub_event+0x4ed/0xe40 drivers/usb/core/hub.c:5742
 process_one_work+0x850/0x1130 kernel/workqueue.c:2307
 worker_thread+0xab1/0x1300 kernel/workqueue.c:2454
 kthread+0x2a3/0x2d0 kernel/kthread.c:377
 ret_from_fork+0x1f/0x30

Memory state around the buggy address:
 ffff8880770b2f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880770b3000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880770b3080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880770b3100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880770b3180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (23):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-smack-root 2022/01/28 02:30 upstream 626b2dda7651 64a8e201 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-smack-root 2022/01/06 09:28 upstream 49ef78e59b07 6acc789a .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/10/10 10:21 upstream 7fd2bf83d59a 838e7e2c .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/10/06 20:58 upstream 60a9483534ed 62ee0987 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/10/06 14:40 upstream 60a9483534ed 0a63fd36 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-smack-root 2021/09/28 17:37 upstream d33bec7b3dfa d82cb927 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/25 09:45 upstream 7d42e9818258 8cac236e .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-smack-root 2021/09/25 01:11 upstream 4c4f0c2bf341 8cac236e .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/22 18:31 upstream cf1d2c3e7e2f 8cac236e .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/22 05:34 upstream 92477dd1faa6 169724fe .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/21 14:46 upstream d9fb678414c0 169724fe .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/21 14:38 upstream d9fb678414c0 169724fe .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/19 13:50 upstream d4d016caa4b8 70b76c1d .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/19 12:55 upstream d4d016caa4b8 70b76c1d .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/16 16:06 upstream ff1ffd71d5f0 aae492f2 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/15 12:59 upstream 3ca706c189db 07e953c1 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-kasan-gce-root 2021/09/14 18:59 upstream 1619b69edce1 07e953c1 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-net-kasan-gce 2022/03/01 18:21 net-next 1e385c08249e 45a13a73 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-net-kasan-gce 2021/12/01 04:41 net-next 196073f9c44b 80270552 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-net-kasan-gce 2021/09/18 19:11 net-next 0efcc3f20145 70b76c1d .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-linux-next-kasan-gce-root 2021/12/14 08:06 linux-next ea922272cbe5 5d14b1ea .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-linux-next-kasan-gce-root 2021/09/15 07:28 linux-next 70ced02f322f 07e953c1 .config log report info KASAN: use-after-free Write in sco_conn_del
ci-upstream-linux-next-kasan-gce-root 2021/09/10 08:58 linux-next aa14a3016182 e2776ee4 .config log report info KASAN: use-after-free Write in sco_conn_del
* Struck through repros no longer work on HEAD.