syzbot


KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync

Status: upstream: reported syz repro on 2024/07/24 08:59
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+479aff51bb361ef5aa18@syzkaller.appspotmail.com
First crash: 199d, last: 2d15h
Discussions (7)
Title Replies (including bot) Last reply
[RFC PATCH] bluetooth: hci: Fix UAF from MGMT_OP_REMOVE_ADV_MONITOR during closure 1 (1) 2024/12/10 04:51
Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync 12 (24) 2024/12/08 22:06
[patch] test 1 (2) 2024/12/05 09:55
[PATCH] [PATCH] TEST 3 (3) 2024/12/05 09:47
[PATCH] test 1 (2) 2024/12/05 09:38
Re: [syzbot] [PATCH] TEST 0 (1) 2024/12/05 09:11
[syzbot] [bluetooth?] KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync 0 (3) 2024/12/05 01:58
Last patch testing requests (16)
Created Duration User Patch Repo Result
2024/12/08 21:44 21m mazin@getstate.dev patch upstream OK log
2024/12/08 19:12 2h29m mazin@getstate.dev patch upstream OK log
2024/12/08 18:24 21m mazin@getstate.dev patch upstream report log
2024/12/08 15:56 27m mazin@getstate.dev patch upstream report log
2024/12/05 15:52 16m mazin@getstate.dev patch upstream report log
2024/12/05 14:27 18m mazin@getstate.dev patch upstream report log
2024/12/05 13:51 17m mazin@getstate.dev patch upstream report log
2024/12/05 13:02 40m mazin@getstate.dev patch upstream report log
2024/12/05 12:20 9m mazin@getstate.dev patch upstream error
2024/12/05 12:18 19m mazin@getstate.dev patch upstream report log
2024/12/05 11:38 24m mazin@getstate.dev patch upstream report log
2024/12/05 09:46 8m xiaopei01@kylinos.cn patch upstream error
2024/12/05 09:30 6m xiaopei01@kylinos.cn patch net error
2024/12/05 09:11 1m xiaopei01@kylinos.cn patch net error
2024/12/05 02:43 21m mazin@getstate.dev patch upstream report log
2024/12/05 01:58 24m mazin@getstate.dev patch upstream report log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in mgmt_remove_adv_monitor_sync+0x3a/0xd0 net/bluetooth/mgmt.c:5543
Read of size 8 at addr ffff88814128f898 by task kworker/u9:4/5961

CPU: 1 UID: 0 PID: 5961 Comm: kworker/u9:4 Not tainted 6.12.0-syzkaller-10684-gf1cd565ce577 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: hci0 hci_cmd_sync_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:94 [inline]
 dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120
 print_address_description mm/kasan/report.c:378 [inline]
 print_report+0x169/0x550 mm/kasan/report.c:489
 kasan_report+0x143/0x180 mm/kasan/report.c:602
 mgmt_remove_adv_monitor_sync+0x3a/0xd0 net/bluetooth/mgmt.c:5543
 hci_cmd_sync_work+0x22b/0x400 net/bluetooth/hci_sync.c:332
 process_one_work kernel/workqueue.c:3229 [inline]
 process_scheduled_works+0xa63/0x1850 kernel/workqueue.c:3310
 worker_thread+0x870/0xd30 kernel/workqueue.c:3391
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>

Allocated by task 16026:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
 __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:394
 kasan_kmalloc include/linux/kasan.h:260 [inline]
 __kmalloc_cache_noprof+0x243/0x390 mm/slub.c:4314
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 mgmt_pending_new+0x65/0x250 net/bluetooth/mgmt_util.c:269
 mgmt_pending_add+0x36/0x120 net/bluetooth/mgmt_util.c:296
 remove_adv_monitor+0x102/0x1b0 net/bluetooth/mgmt.c:5568
 hci_mgmt_cmd+0xc47/0x11d0 net/bluetooth/hci_sock.c:1712
 hci_sock_sendmsg+0x7b8/0x11c0 net/bluetooth/hci_sock.c:1832
 sock_sendmsg_nosec net/socket.c:711 [inline]
 __sock_sendmsg+0x221/0x270 net/socket.c:726
 sock_write_iter+0x2d7/0x3f0 net/socket.c:1147
 new_sync_write fs/read_write.c:586 [inline]
 vfs_write+0xaeb/0xd30 fs/read_write.c:679
 ksys_write+0x18f/0x2b0 fs/read_write.c:731
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 16022:
 kasan_save_stack mm/kasan/common.c:47 [inline]
 kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:582
 poison_slab_object mm/kasan/common.c:247 [inline]
 __kasan_slab_free+0x59/0x70 mm/kasan/common.c:264
 kasan_slab_free include/linux/kasan.h:233 [inline]
 slab_free_hook mm/slub.c:2338 [inline]
 slab_free mm/slub.c:4598 [inline]
 kfree+0x196/0x420 mm/slub.c:4746
 mgmt_pending_foreach+0xd1/0x130 net/bluetooth/mgmt_util.c:259
 __mgmt_power_off+0x183/0x430 net/bluetooth/mgmt.c:9550
 hci_dev_close_sync+0x6c4/0x11c0 net/bluetooth/hci_sync.c:5208
 hci_dev_do_close net/bluetooth/hci_core.c:483 [inline]
 hci_dev_close+0x112/0x210 net/bluetooth/hci_core.c:508
 sock_do_ioctl+0x158/0x460 net/socket.c:1209
 sock_ioctl+0x626/0x8e0 net/socket.c:1328
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892
 do_syscall_x64 arch/x86/entry/common.c:52 [inline]
 do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88814128f880
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 24 bytes inside of
 freed 96-byte region [ffff88814128f880, ffff88814128f8e0)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x14128f
anon flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 057ff00000000000 ffff88801ac41280 ffffea000503ba00 dead000000000005
raw: 0000000000000000 0000000000200020 00000001f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x52cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 1, tgid 1 (swapper/0), ts 3811348328, free_ts 0
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556
 prep_new_page mm/page_alloc.c:1564 [inline]
 get_page_from_freelist+0x3649/0x3790 mm/page_alloc.c:3474
 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751
 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265
 alloc_slab_page+0x6a/0x140 mm/slub.c:2408
 allocate_slab+0x5a/0x2f0 mm/slub.c:2574
 new_slab mm/slub.c:2627 [inline]
 ___slab_alloc+0xcd1/0x14b0 mm/slub.c:3815
 __slab_alloc+0x58/0xa0 mm/slub.c:3905
 __slab_alloc_node mm/slub.c:3980 [inline]
 slab_alloc_node mm/slub.c:4141 [inline]
 __kmalloc_cache_noprof+0x27b/0x390 mm/slub.c:4309
 kmalloc_noprof include/linux/slab.h:901 [inline]
 kzalloc_noprof include/linux/slab.h:1037 [inline]
 acpi_evaluate_object+0x15c/0xaf0 drivers/acpi/acpica/nsxfeval.c:177
 acpi_pci_link_add+0x507/0x630 drivers/acpi/pci_link.c:745
 acpi_scan_attach_handler drivers/acpi/scan.c:2260 [inline]
 acpi_bus_attach+0x7ab/0xcb0 drivers/acpi/scan.c:2309
 device_for_each_child+0x118/0x1b0 drivers/base/core.c:4001
 acpi_dev_for_each_child+0xd0/0x110 drivers/acpi/bus.c:1157
 acpi_bus_attach+0x9f4/0xcb0 drivers/acpi/scan.c:2329
 device_for_each_child+0x118/0x1b0 drivers/base/core.c:4001
page_owner free stack trace missing

Memory state around the buggy address:
 ffff88814128f780: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
 ffff88814128f800: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
>ffff88814128f880: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                            ^
 ffff88814128f900: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
 ffff88814128f980: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
==================================================================

Crashes (37):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/11/30 07:55 net f1cd565ce577 68914665 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/28 06:52 net 5dfd7d940094 5df23865 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/22 04:38 upstream fcc79e1714e8 4b25d554 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-smack-root KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/09/12 08:51 upstream 7c6a3a65ace7 d94c83d8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/18 21:16 upstream c061cf420ded 1432fc84 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/11 23:47 upstream 231825b2e1ff 6f1b0fa8 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/28 13:32 upstream b86545e02e8c 5df23865 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/25 02:25 upstream 9f16d5e6f220 68da6d95 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/01 17:03 upstream 6c52d4da1c74 9f6834c9 .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/10/04 07:01 upstream 3840cbe24cf0 d7906eff .config console log report info [disk image (non-bootable)] [vmlinux] [kernel image] ci-qemu-upstream-386 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/08 13:10 net 4c49f38e20a5 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/08 06:43 net 4c49f38e20a5 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/07 01:24 net 11776cff0b56 9ac0fdc6 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/06 08:20 net 896d8946da97 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/04 13:24 net af8edaeddbc5 b50eb251 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/02 19:25 net 28866d6e84b8 bb326ffb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/12/01 18:36 net c44daa7e3c73 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/30 01:18 net f1cd565ce577 68914665 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/11/25 03:09 net f26a29a038ee 68da6d95 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/10/24 03:41 net 6e62807c7fbb 15fa2979 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/09/01 04:54 net fe1910f9337b 1eda0d14 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/08/30 00:29 net febccb39255f 54fe8471 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/08/27 18:16 net bc21000e99f9 6c853ff9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/08/04 14:15 net 14ab4792ee12 1786a2a8 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-this-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/10/14 07:56 net-next 6aac56631831 084d8178 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/10/02 22:29 net-next 44badc908f2c a4c7fd36 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/09/28 04:14 net-next c824deb1a897 440b26ec .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/09/25 09:11 net-next 151ac45348af 349a68c4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/09/06 20:44 net-next 52fc70a32573 ce70880a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/09/06 20:39 net-next 52fc70a32573 ce70880a .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/08/30 10:56 net-next 670726a8262e 54fe8471 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/07/24 08:58 net-next d7e78951a8b8 57b2edb1 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/07/22 23:09 net-next d7e78951a8b8 f063dfd9 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/07/11 12:19 net-next ce2f84ebcd85 c699c2eb .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/06/05 08:26 net-next 2b438c5774cc e1e2c66e .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-net-kasan-gce KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/10/05 06:24 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 3eddb108abe3 d7906eff .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
2024/06/12 12:16 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 8867bbd4a056 4d75f4f7 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-gce-arm64 KASAN: slab-use-after-free Read in mgmt_remove_adv_monitor_sync
* Struck through repros no longer work on HEAD.