syzbot


KASAN: use-after-free Read in try_to_wake_up (2)

Status: upstream: reported on 2024/12/06 09:57
Reported-by: syzbot+12f93ab4870a80b8ad16@syzkaller.appspotmail.com
First crash: 15d, last: 16h25m
Similar bugs (11)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 KASAN: use-after-free Read in try_to_wake_up C done 71 93d 548d 3/3 fixed on 2024/10/21 12:01
linux-4.14 KASAN: use-after-free Read in try_to_wake_up nilfs2 C 8 661d 783d 0/1 upstream: reported C repro on 2022/10/30 09:08
upstream general protection fault in try_to_wake_up (2) io-uring C done done 3588 155d 1394d 0/28 closed as invalid on 2024/07/25 16:29
upstream KASAN: use-after-free Read in try_to_wake_up fs C unreliable 82 1394d 1394d 0/28 closed as invalid on 2021/02/25 16:53
linux-6.1 KASAN: use-after-free Read in try_to_wake_up origin:upstream missing-backport C done 44 197d 628d 3/3 fixed on 2024/07/22 09:08
linux-6.1 KASAN: use-after-free Read in try_to_wake_up (2) 2 107d 138d 0/3 auto-obsoleted due to no activity on 2024/12/14 10:22
upstream WARNING: locking bug in try_to_wake_up (2) net syz 64 1h31m 34d 0/28 upstream: reported syz repro on 2024/11/17 07:17
linux-4.14 general protection fault in try_to_wake_up C done 707 1345d 1374d 1/1 fixed on 2021/05/17 08:49
upstream WARNING: locking bug in try_to_wake_up kernel C error 157 39d 219d 28/28 fixed on 2024/11/12 23:31
linux-4.19 general protection fault in try_to_wake_up syz done 229 1287d 1374d 1/1 fixed on 2021/07/14 00:01
upstream BUG: unable to handle kernel paging request in try_to_wake_up (2) btrfs C error 14 22h10m 25d 26/28 upstream: reported C repro on 2024/11/26 04:54

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x74/0x1ff0 kernel/locking/lockdep.c:4882
Read of size 8 at addr ffff888061ce27e8 by task kworker/u4:7/4537

CPU: 0 PID: 4537 Comm: kworker/u4:7 Not tainted 5.15.173-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
Workqueue: btrfs-delalloc btrfs_work_helper
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 __lock_acquire+0x74/0x1ff0 kernel/locking/lockdep.c:4882
 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
 try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4027
 async_cow_start+0x5c/0x80 fs/btrfs/inode.c:1345
 btrfs_work_helper+0x36e/0xbc0 fs/btrfs/async-thread.c:325
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 2:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x53/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3220 [inline]
 kmem_cache_alloc_node+0x121/0x2c0 mm/slub.c:3256
 alloc_task_struct_node kernel/fork.c:172 [inline]
 dup_task_struct+0x57/0xb60 kernel/fork.c:895
 copy_process+0x5eb/0x3ef0 kernel/fork.c:2036
 kernel_clone+0x210/0x960 kernel/fork.c:2603
 kernel_thread+0x168/0x1e0 kernel/fork.c:2655
 create_kthread kernel/kthread.c:357 [inline]
 kthreadd+0x57a/0x740 kernel/kthread.c:703
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Freed by task 14:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x80 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1705 [inline]
 slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731
 slab_free mm/slub.c:3499 [inline]
 kmem_cache_free+0x91/0x1f0 mm/slub.c:3515
 rcu_do_batch kernel/rcu/tree.c:2523 [inline]
 rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763
 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558
 run_ksoftirqd+0xc6/0x120 kernel/softirq.c:925
 smpboot_thread_fn+0x51b/0x9d0 kernel/smpboot.c:164
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 context_switch kernel/sched/core.c:5030 [inline]
 __schedule+0x12cc/0x45b0 kernel/sched/core.c:6373
 preempt_schedule_notrace+0xf8/0x140 kernel/sched/core.c:6628
 preempt_schedule_notrace_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35
 rcu_is_watching+0x72/0xa0 kernel/rcu/tree.c:1124
 trace_kmalloc include/trace/events/kmem.h:46 [inline]
 kmem_cache_alloc_trace+0x12a/0x290 mm/slub.c:3246
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 sctp_inet6addr_event+0x363/0x700 net/sctp/ipv6.c:86
 notifier_call_chain kernel/notifier.c:83 [inline]
 atomic_notifier_call_chain+0x15f/0x290 kernel/notifier.c:198
 ipv6_add_addr+0xb00/0xd80 net/ipv6/addrconf.c:1182
 addrconf_add_linklocal+0x309/0xa30 net/ipv6/addrconf.c:3242
 addrconf_addr_gen+0x851/0xc00
 addrconf_dev_config net/ipv6/addrconf.c:3418 [inline]
 addrconf_init_auto_addrs+0x930/0xe90 net/ipv6/addrconf.c:3496
 addrconf_notify+0xa90/0xf30 net/ipv6/addrconf.c:3665
 notifier_call_chain kernel/notifier.c:83 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:391
 call_netdevice_notifiers_info net/core/dev.c:2018 [inline]
 netdev_state_change+0x1a3/0x250 net/core/dev.c:1409
 linkwatch_do_dev+0x10c/0x160 net/core/link_watch.c:167
 __linkwatch_run_queue+0x4ca/0x7f0 net/core/link_watch.c:213
 linkwatch_event+0x48/0x50 net/core/link_watch.c:252
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Second to last potentially related work creation:
 kasan_save_stack+0x36/0x60 mm/kasan/common.c:38
 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348
 __call_rcu kernel/rcu/tree.c:3007 [inline]
 call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087
 context_switch kernel/sched/core.c:5030 [inline]
 __schedule+0x12cc/0x45b0 kernel/sched/core.c:6373
 preempt_schedule_common+0x83/0xd0 kernel/sched/core.c:6549
 preempt_schedule+0xd9/0xe0 kernel/sched/core.c:6574
 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:34
 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
 _raw_spin_unlock_irq+0x3c/0x40 kernel/locking/spinlock.c:202
 spin_unlock_irq include/linux/spinlock.h:413 [inline]
 do_group_exit+0x254/0x310 kernel/exit.c:993
 __do_sys_exit_group kernel/exit.c:1007 [inline]
 __se_sys_exit_group kernel/exit.c:1005 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1005
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888061ce1dc0
 which belongs to the cache task_struct of size 7360
The buggy address is located 2600 bytes inside of
 7360-byte region [ffff888061ce1dc0, ffff888061ce3a80)
The buggy address belongs to the page:
page:ffffea0001873800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x61ce0
head:ffffea0001873800 order:3 compound_mapcount:0 compound_pincount:0
memcg:ffff8880664e0981
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff8880175e93c0
raw: 0000000000000000 0000000000040004 00000001ffffffff ffff8880664e0981
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 2, ts 66566143670, free_ts 21108042267
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5464
 alloc_slab_page mm/slub.c:1775 [inline]
 allocate_slab mm/slub.c:1912 [inline]
 new_slab+0xbb/0x4b0 mm/slub.c:1975
 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008
 __slab_alloc mm/slub.c:3095 [inline]
 slab_alloc_node mm/slub.c:3186 [inline]
 kmem_cache_alloc_node+0x1ba/0x2c0 mm/slub.c:3256
 alloc_task_struct_node kernel/fork.c:172 [inline]
 dup_task_struct+0x57/0xb60 kernel/fork.c:895
 copy_process+0x5eb/0x3ef0 kernel/fork.c:2036
 kernel_clone+0x210/0x960 kernel/fork.c:2603
 kernel_thread+0x168/0x1e0 kernel/fork.c:2655
 create_kthread kernel/kthread.c:357 [inline]
 kthreadd+0x57a/0x740 kernel/kthread.c:703
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 free_contig_range+0x95/0xf0 mm/page_alloc.c:9383
 destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018
 debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331
 do_one_initcall+0x22b/0x7a0 init/main.c:1302
 do_initcall_level+0x157/0x210 init/main.c:1375
 do_initcalls+0x49/0x90 init/main.c:1391
 kernel_init_freeable+0x425/0x5c0 init/main.c:1615
 kernel_init+0x19/0x290 init/main.c:1506
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287

Memory state around the buggy address:
 ffff888061ce2680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888061ce2700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888061ce2780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff888061ce2800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888061ce2880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/12/06 09:56 linux-5.15.y 0a51d2d4527b 946d28f0 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in try_to_wake_up
2024/12/20 23:47 linux-5.15.y 91786f140358 d7f584ee .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan-arm64 KASAN: use-after-free Read in try_to_wake_up
* Struck through repros no longer work on HEAD.