syzbot


KASAN: use-after-free Write in mod_delayed_work_on

Status: auto-obsoleted due to no activity on 2022/11/27 09:05
Reported-by: syzbot+9f71da10c0a6ca75e8d8@syzkaller.appspotmail.com
First crash: 628d, last: 628d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 KASAN: use-after-free Read in mod_delayed_work_on 2 2d18h 20d 0/2 premoderation: reported on 2024/03/29 22:18

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __write_once_size include/linux/compiler.h:295 [inline]
BUG: KASAN: use-after-free in __hlist_del include/linux/list.h:771 [inline]
BUG: KASAN: use-after-free in detach_timer kernel/time/timer.c:824 [inline]
BUG: KASAN: use-after-free in detach_if_pending kernel/time/timer.c:841 [inline]
BUG: KASAN: use-after-free in del_timer+0x279/0x460 kernel/time/timer.c:1212
Write of size 8 at addr ffff8881e56371c0 by task syz-executor.2/27511

CPU: 0 PID: 27511 Comm: syz-executor.2 Not tainted 5.4.197-syzkaller-00110-g2bde2e268ec7 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x18e/0x1d5 lib/dump_stack.c:118
 print_address_description+0x8c/0x630 mm/kasan/report.c:384
 __kasan_report+0xf6/0x130 mm/kasan/report.c:516
 kasan_report+0x30/0x60 mm/kasan/common.c:653
 __write_once_size include/linux/compiler.h:295 [inline]
 __hlist_del include/linux/list.h:771 [inline]
 detach_timer kernel/time/timer.c:824 [inline]
 detach_if_pending kernel/time/timer.c:841 [inline]
 del_timer+0x279/0x460 kernel/time/timer.c:1212
 try_to_grab_pending+0x99/0x940 kernel/workqueue.c:1268
 mod_delayed_work_on+0x6e/0x110 kernel/workqueue.c:1729
 mod_delayed_work include/linux/workqueue.h:530 [inline]
 wb_wakeup fs/fs-writeback.c:157 [inline]
 wb_start_writeback fs/fs-writeback.c:1102 [inline]
 __wakeup_flusher_threads_bdi+0x206/0x280 fs/fs-writeback.c:2123
 wakeup_flusher_threads+0xff/0x150 fs/fs-writeback.c:2149
 shrink_inactive_list+0x678/0xea0 mm/vmscan.c:2030
 shrink_list mm/vmscan.c:2288 [inline]
 shrink_node_memcg+0x501/0xf40 mm/vmscan.c:2618
 shrink_node+0x364/0x1320 mm/vmscan.c:2831
 shrink_zones+0x416/0x8b0 mm/vmscan.c:3048
 do_try_to_free_pages+0x21b/0x990 mm/vmscan.c:3106
 try_to_free_mem_cgroup_pages+0x32d/0x850 mm/vmscan.c:3407
 reclaim_high+0xaf/0xe0 mm/memcontrol.c:2367
 mem_cgroup_handle_over_high+0xc2/0x190 mm/memcontrol.c:2515
 tracehook_notify_resume include/linux/tracehook.h:197 [inline]
 exit_to_usermode_loop+0x147/0x1d0 arch/x86/entry/common.c:163
 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194
 retint_user+0x8/0x8
RIP: 0033:0x7f6bcd69fe7c
Code: aa 58 ff ff 41 39 5c 24 2c 7f d3 31 c0 48 8d 3d 03 22 0b 00 e8 95 58 ff ff 48 8b 44 24 08 c7 44 24 1c ff ff ff ff 44 8b 60 78 <c6> 80 c8 00 00 00 00 45 85 e4 0f 8e 83 00 00 00 48 8b 44 24 08 8b
RSP: 002b:00007f6bcc86f190 EFLAGS: 00010202
RAX: 00007f6bcd80bf60 RBX: 0000000000000004 RCX: 00007f6bcd760db5
RDX: 0000000000215714 RSI: 0000000000000000 RDI: 00007f6bcd752069
RBP: 00007f6bcd753161 R08: 00007ffcb71c7080 R09: 00007ffcb71c70b8
R10: 000000000005af00 R11: 00000000000008d4 R12: 0000000000000000
R13: 00007ffcb718cb6f R14: 00007f6bcc86f300 R15: 0000000000022000

The buggy address belongs to the page:
page:ffffea0007958dc0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x8000000000000000()
raw: 8000000000000000 0000000000000000 ffffea0007958dc8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x140dc0(GFP_USER|__GFP_COMP|__GFP_ZERO)
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook mm/page_alloc.c:2165 [inline]
 prep_new_page+0x194/0x380 mm/page_alloc.c:2171
 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794
 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857
 __alloc_pages include/linux/gfp.h:503 [inline]
 __alloc_pages_node include/linux/gfp.h:516 [inline]
 alloc_pages_node include/linux/gfp.h:530 [inline]
 kmalloc_order mm/slab_common.c:1342 [inline]
 kmalloc_order_trace+0x2a/0xf0 mm/slab_common.c:1358
 kmalloc_large include/linux/slab.h:485 [inline]
 kmalloc include/linux/slab.h:549 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 tipc_nametbl_init+0x93/0x260 net/tipc/name_table.c:738
 tipc_init_net+0x229/0x360 net/tipc/core.c:74
 ops_init+0x278/0x350 net/core/net_namespace.c:137
 setup_net+0x1bb/0x9e0 net/core/net_namespace.c:338
 copy_net_ns+0x2d4/0x470 net/core/net_namespace.c:479
 create_new_namespaces+0x440/0x5e0 kernel/nsproxy.c:103
 copy_namespaces+0x169/0x1b0 kernel/nsproxy.c:161
 copy_process+0x12a4/0x3200 kernel/fork.c:2044
 _do_fork+0x142/0x730 kernel/fork.c:2391
 __do_sys_clone kernel/fork.c:2549 [inline]
 __se_sys_clone kernel/fork.c:2530 [inline]
 __x64_sys_clone+0x213/0x260 kernel/fork.c:2530
 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1176 [inline]
 __free_pages_ok+0x7ee/0x920 mm/page_alloc.c:1438
 free_the_page mm/page_alloc.c:4919 [inline]
 __free_pages+0x45/0x1e0 mm/page_alloc.c:4925
 kfree+0x1ef/0x260 mm/slub.c:4068
 tipc_exit_net+0x92/0x100 net/tipc/core.c:108
 ops_exit_list net/core/net_namespace.c:172 [inline]
 cleanup_net+0x654/0xca0 net/core/net_namespace.c:602
 process_one_work+0x6ca/0xc40 kernel/workqueue.c:2287
 worker_thread+0xae0/0x1440 kernel/workqueue.c:2433
 kthread+0x2d8/0x360 kernel/kthread.c:288
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:352

Memory state around the buggy address:
 ffff8881e5637080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881e5637100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881e5637180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                           ^
 ffff8881e5637200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8881e5637280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2022/07/30 09:04 android12-5.4 2bde2e268ec7 fef302b1 .config console log report info ci2-android-5-4-perf-kasan KASAN: use-after-free Write in mod_delayed_work_on
* Struck through repros no longer work on HEAD.