syzbot


KASAN: use-after-free Write in enqueue_timer (2)

Status: premoderation: reported on 2025/11/01 08:53
Reported-by: syzbot+c986a0ea1d1af31b3004@syzkaller.appspotmail.com
First crash: 18d, last: 18d
Similar bugs (8)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-54 KASAN: use-after-free Write in enqueue_timer (2) 24 C 5369 177d 275d 0/2 upstream: reported C repro on 2025/02/17 15:17
android-54 KASAN: use-after-free Write in enqueue_timer 24 C 4288 504d 1010d 0/2 auto-obsoleted due to no activity on 2024/09/11 16:22
upstream KASAN: use-after-free Write in enqueue_timer net 24 1 1100d 1100d 22/29 fixed on 2023/02/24 13:50
android-5-15 KASAN: use-after-free Write in enqueue_timer 24 1 671d 671d 0/2 auto-obsoleted due to no activity on 2024/04/17 12:01
android-6-1 KASAN: use-after-free Write in enqueue_timer origin:lts 24 C 278 2d11h 482d 0/2 upstream: reported C repro on 2024/07/25 13:16
upstream KASAN: slab-use-after-free Write in enqueue_timer net 24 18 918d 934d 0/29 auto-obsoleted due to no activity on 2023/08/22 15:17
upstream KASAN: slab-out-of-bounds Write in enqueue_timer bluetooth 23 1 154d 149d 0/29 auto-obsoleted due to no activity on 2025/09/26 09:41
upstream KASAN: invalid-access Write in enqueue_timer ext4 -1 20 1715d 1737d 0/29 auto-closed as invalid on 2021/07/08 00:48

Sample crash report:
usb 1-1: USB disconnect, device number 20
==================================================================
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:902 [inline]
BUG: KASAN: use-after-free in enqueue_timer+0xae/0x480 kernel/time/timer.c:588
Write of size 8 at addr ffff88811ef5c8e0 by task kworker/1:2/60

CPU: 1 PID: 60 Comm: kworker/1:2 Tainted: G        W         syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/2025
Workqueue: usb_hub_wq hub_event
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:88
 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0xf1/0x140 mm/kasan/report.c:444
 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report_generic.c:314
 hlist_add_head include/linux/list.h:902 [inline]
 enqueue_timer+0xae/0x480 kernel/time/timer.c:588
 __mod_timer+0x79f/0xb30 kernel/time/timer.c:-1
 schedule_timeout+0x127/0x2e0 kernel/time/timer.c:1919
 do_wait_for_common kernel/sched/completion.c:85 [inline]
 __wait_for_common kernel/sched/completion.c:106 [inline]
 wait_for_common+0x26b/0x420 kernel/sched/completion.c:117
 wait_for_completion_timeout+0xe/0x10 kernel/sched/completion.c:157
 usb_start_wait_urb+0x166/0x2f0 drivers/usb/core/message.c:63
 usb_internal_control_msg drivers/usb/core/message.c:102 [inline]
 usb_control_msg+0x241/0x3f0 drivers/usb/core/message.c:153
 get_port_status drivers/usb/core/hub.c:597 [inline]
 hub_ext_port_status+0x100/0x6b0 drivers/usb/core/hub.c:614
 hub_port_status drivers/usb/core/hub.c:636 [inline]
 hub_port_debounce+0x53/0x250 drivers/usb/core/hub.c:4685
 hub_port_debounce_be_stable drivers/usb/core/hub.h:173 [inline]
 hub_port_connect drivers/usb/core/hub.c:5406 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5695 [inline]
 port_event drivers/usb/core/hub.c:5861 [inline]
 hub_event+0x1b1d/0x4480 drivers/usb/core/hub.c:5943
 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
 kthread+0x411/0x500 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 10817:
 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:433 [inline]
 ____kasan_kmalloc mm/kasan/common.c:512 [inline]
 __kasan_kmalloc+0xda/0x110 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 __kmalloc+0x13d/0x2c0 mm/slub.c:4436
 kmalloc include/linux/slab.h:624 [inline]
 kzalloc include/linux/slab.h:750 [inline]
 hci_alloc_dev_priv+0x27/0x1ba0 net/bluetooth/hci_core.c:3775
 hci_alloc_dev include/net/bluetooth/hci_core.h:1257 [inline]
 hci_uart_register_dev drivers/bluetooth/hci_ldisc.c:638 [inline]
 hci_uart_set_proto drivers/bluetooth/hci_ldisc.c:716 [inline]
 hci_uart_tty_ioctl+0x40c/0xa70 drivers/bluetooth/hci_ldisc.c:772
 tty_ioctl+0x8dc/0xc60 drivers/tty/tty_io.c:2819
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0x121/0x1a0 fs/ioctl.c:860
 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:860
 x64_sys_call+0x2f/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:17
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 10814:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1728 [inline]
 slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1754
 slab_free mm/slub.c:3526 [inline]
 kfree+0xc4/0x270 mm/slub.c:4588
 hci_release_dev+0x1364/0x14b0 net/bluetooth/hci_core.c:4094
 bt_host_release+0x82/0x90 net/bluetooth/hci_sysfs.c:85
 device_release+0x96/0x1c0 drivers/base/core.c:-1
 kobject_cleanup lib/kobject.c:713 [inline]
 kobject_release lib/kobject.c:744 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x18a/0x270 lib/kobject.c:761
 put_device+0x1f/0x30 drivers/base/core.c:3530
 hci_free_dev+0x1c/0x20 net/bluetooth/hci_core.c:3895
 hci_uart_tty_close+0x1a3/0x220 drivers/bluetooth/hci_ldisc.c:552
 tty_ldisc_close drivers/tty/tty_ldisc.c:474 [inline]
 tty_ldisc_kill+0x101/0x1e0 drivers/tty/tty_ldisc.c:629
 tty_ldisc_release+0x1a5/0x200 drivers/tty/tty_ldisc.c:803
 tty_release_struct+0x29/0xe0 drivers/tty/tty_io.c:1708
 tty_release+0xcad/0x1320 drivers/tty/tty_io.c:1880
 __fput+0x20b/0x8b0 fs/file_table.c:311
 ____fput+0x15/0x20 fs/file_table.c:339
 task_work_run+0x127/0x190 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0xd0/0xe0 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0x87/0xd0 kernel/entry/common.c:214
 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline]
 syscall_exit_to_user_mode+0x1a/0x30 kernel/entry/common.c:307
 do_syscall_64+0x58/0xa0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 insert_work+0x51/0x310 kernel/workqueue.c:1373
 __queue_work+0x8e5/0xc60 kernel/workqueue.c:1539
 queue_work_on+0xd2/0x140 kernel/workqueue.c:1566
 queue_work include/linux/workqueue.h:510 [inline]
 hci_cmd_timeout+0x183/0x1f0 net/bluetooth/hci_core.c:2788
 process_one_work+0x6be/0xba0 kernel/workqueue.c:2325
 worker_thread+0xa59/0x1200 kernel/workqueue.c:2472
 kthread+0x411/0x500 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Second to last potentially related work creation:
 kasan_save_stack+0x3a/0x60 mm/kasan/common.c:38
 __kasan_record_aux_stack+0xd2/0x100 mm/kasan/generic.c:348
 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:358
 insert_work+0x51/0x310 kernel/workqueue.c:1373
 __queue_work+0x8e5/0xc60 kernel/workqueue.c:1539
 delayed_work_timer_fn+0x61/0x80 kernel/workqueue.c:1664
 call_timer_fn+0x38/0x290 kernel/time/timer.c:1457
 expire_timers kernel/time/timer.c:1497 [inline]
 __run_timers+0x667/0x9a0 kernel/time/timer.c:1773
 run_timer_softirq+0x6a/0xf0 kernel/time/timer.c:1786
 handle_softirqs+0x250/0x560 kernel/softirq.c:583
 __do_softirq kernel/softirq.c:621 [inline]
 invoke_softirq kernel/softirq.c:443 [inline]
 __irq_exit_rcu+0x52/0xf0 kernel/softirq.c:670
 irq_exit_rcu+0x9/0x10 kernel/softirq.c:682
 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline]
 sysvec_apic_timer_interrupt+0xa9/0xc0 arch/x86/kernel/apic/apic.c:1108
 asm_sysvec_apic_timer_interrupt+0x1b/0x20 arch/x86/include/asm/idtentry.h:676

The buggy address belongs to the object at ffff88811ef5c000
 which belongs to the cache kmalloc-8k of size 8192
The buggy address is located 2272 bytes inside of
 8192-byte region [ffff88811ef5c000, ffff88811ef5e000)
The buggy address belongs to the page:
page:ffffea00047bd600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88811ef58000 pfn:0x11ef58
head:ffffea00047bd600 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=1)
raw: 4000000000010200 ffffea0004704208 ffffea000456f208 ffff888100043500
raw: ffff88811ef58000 0000000000020001 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 7737, ts 364249727901, free_ts 363979525887
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x192/0x1b0 mm/page_alloc.c:2605
 prep_new_page+0x1c/0x110 mm/page_alloc.c:2611
 get_page_from_freelist+0x2cc5/0x2d50 mm/page_alloc.c:4485
 __alloc_pages+0x18f/0x440 mm/page_alloc.c:5808
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1937 [inline]
 new_slab+0xa1/0x4d0 mm/slub.c:2000
 ___slab_alloc+0x381/0x810 mm/slub.c:3033
 __slab_alloc+0x49/0x90 mm/slub.c:3120
 slab_alloc_node mm/slub.c:3211 [inline]
 slab_alloc mm/slub.c:3255 [inline]
 __kmalloc+0x16a/0x2c0 mm/slub.c:4432
 __kmalloc_node include/linux/slab.h:487 [inline]
 kmalloc_node include/linux/slab.h:642 [inline]
 alloc_callchain_buffers kernel/events/callchain.c:90 [inline]
 get_callchain_buffers+0x15b/0x370 kernel/events/callchain.c:134
 check_helper_call+0x47d4/0x5530 kernel/bpf/verifier.c:6768
 do_check+0x6108/0xea60 kernel/bpf/verifier.c:11405
 do_check_common+0xff5/0x19a0 kernel/bpf/verifier.c:13478
 do_check_main kernel/bpf/verifier.c:13541 [inline]
 bpf_check+0x32a0/0xf280 kernel/bpf/verifier.c:14112
 bpf_prog_load+0x1042/0x1550 kernel/bpf/syscall.c:2328
 __sys_bpf+0x4c3/0x730 kernel/bpf/syscall.c:4633
 __do_sys_bpf kernel/bpf/syscall.c:4737 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:4735 [inline]
 __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:4735
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1472 [inline]
 free_pcp_prepare mm/page_alloc.c:1544 [inline]
 free_unref_page_prepare+0x542/0x550 mm/page_alloc.c:3534
 free_unref_page+0xa2/0x550 mm/page_alloc.c:3616
 free_the_page mm/page_alloc.c:805 [inline]
 __free_pages+0x6c/0x100 mm/page_alloc.c:5884
 __free_slab+0xe8/0x1e0 mm/slub.c:2025
 free_slab mm/slub.c:2040 [inline]
 discard_slab mm/slub.c:2046 [inline]
 free_partial mm/slub.c:4305 [inline]
 __kmem_cache_shutdown+0x435/0x490 mm/slub.c:4330
 shutdown_cache mm/slab_common.c:466 [inline]
 kmem_cache_destroy+0x50/0x140 mm/slab_common.c:512
 p9_client_destroy+0x3a9/0x3f0 net/9p/client.c:1110
 v9fs_session_close+0x4e/0x1c0 fs/9p/v9fs.c:501
 v9fs_kill_super+0x5c/0x90 fs/9p/vfs_super.c:226
 deactivate_locked_super+0xa0/0x100 fs/super.c:335
 deactivate_super+0xaf/0xe0 fs/super.c:366
 cleanup_mnt+0x446/0x500 fs/namespace.c:1148
 __cleanup_mnt+0x19/0x20 fs/namespace.c:1155
 task_work_run+0x127/0x190 kernel/task_work.c:188
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop+0xd0/0xe0 kernel/entry/common.c:181
 exit_to_user_mode_prepare+0x87/0xd0 kernel/entry/common.c:214

Memory state around the buggy address:
 ffff88811ef5c780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811ef5c800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88811ef5c880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88811ef5c900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88811ef5c980: 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/11/01 08:52 android13-5.15-lts 1edb21e89ce4 2c50b6a9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in enqueue_timer
* Struck through repros no longer work on HEAD.