================================================================== BUG: KASAN: use-after-free in __list_add_valid+0x81/0xa0 lib/list_debug.c:23 Read of size 8 at addr ffff88806a383ea8 by task syz-executor.2/11107 CPU: 0 PID: 11107 Comm: syz-executor.2 Not tainted 5.18.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 __list_add_valid+0x81/0xa0 lib/list_debug.c:23 __list_add include/linux/list.h:69 [inline] list_add include/linux/list.h:88 [inline] rcu_tasks_trace_qs_blkd+0xf0/0x310 kernel/rcu/tasks.h:1278 rcu_note_context_switch+0xe64/0x1840 kernel/rcu/tree_plugin.h:357 __schedule+0x236/0x4900 kernel/sched/core.c:6279 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:6547 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35 migrate_disable+0x113/0x160 kernel/sched/core.c:2239 bpf_prog_run_pin_on_cpu include/linux/filter.h:651 [inline] bpf_prog_test_run_syscall+0x299/0x660 net/bpf/test_run.c:1565 bpf_prog_test_run kernel/bpf/syscall.c:3369 [inline] __sys_bpf+0x1840/0x4360 kernel/bpf/syscall.c:4681 __do_sys_bpf kernel/bpf/syscall.c:4767 [inline] __se_sys_bpf kernel/bpf/syscall.c:4765 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4765 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f840de89109 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f840d5fe168 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f840df9bf60 RCX: 00007f840de89109 RDX: 0000000000000048 RSI: 0000000020000500 RDI: 000000000000000a RBP: 00007f840dee30ad R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd3184b3df R14: 00007f840d5fe300 R15: 0000000000022000 Allocated by task 11050: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:749 [inline] slab_alloc_node mm/slub.c:3217 [inline] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3267 alloc_task_struct_node kernel/fork.c:172 [inline] dup_task_struct kernel/fork.c:970 [inline] copy_process+0x46a/0x6960 kernel/fork.c:2069 kernel_clone+0xb8/0x7f0 kernel/fork.c:2640 __do_sys_clone+0xaf/0xf0 kernel/fork.c:2757 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 4027: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3510 [inline] kmem_cache_free+0xdd/0x5a0 mm/slub.c:3527 rcu_do_batch kernel/rcu/tree.c:2662 [inline] rcu_core+0x7b5/0x18a0 kernel/rcu/tree.c:2922 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3210 context_switch kernel/sched/core.c:5076 [inline] __schedule+0xa62/0x4900 kernel/sched/core.c:6382 schedule+0xd2/0x1f0 kernel/sched/core.c:6454 freezable_schedule include/linux/freezer.h:172 [inline] do_nanosleep+0x20d/0x5b0 kernel/time/hrtimer.c:2044 hrtimer_nanosleep+0x1ac/0x3b0 kernel/time/hrtimer.c:2097 common_nsleep+0x74/0xb0 kernel/time/posix-timers.c:1227 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1267 [inline] __se_sys_clock_nanosleep kernel/time/posix-timers.c:1245 [inline] __x64_sys_clock_nanosleep+0x256/0x3b0 kernel/time/posix-timers.c:1245 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 call_rcu+0x99/0x790 kernel/rcu/tree.c:3210 release_task+0xb5e/0x14d0 kernel/exit.c:229 wait_task_zombie kernel/exit.c:1111 [inline] wait_consider_task+0x28db/0x3530 kernel/exit.c:1338 do_wait_thread kernel/exit.c:1401 [inline] do_wait+0x63e/0xaa0 kernel/exit.c:1518 kernel_wait4+0xee/0x1c0 kernel/exit.c:1681 __do_sys_wait4+0xe8/0x100 kernel/exit.c:1709 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88806a383a00 which belongs to the cache task_struct of size 7168 The buggy address is located 1192 bytes inside of 7168-byte region [ffff88806a383a00, ffff88806a385600) The buggy address belongs to the physical page: page:ffffea0001a8e000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6a380 head:ffffea0001a8e000 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88807b483cc1 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00019a4c00 dead000000000002 ffff888140006280 raw: 0000000000000000 0000000000040004 00000001ffffffff ffff88807b483cc1 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 4330, tgid 4330 (syz-executor.1), ts 73526954802, free_ts 9008369052 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0x178d/0x3da0 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8e1/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] kmem_cache_alloc_node+0x122/0x3f0 mm/slub.c:3267 alloc_task_struct_node kernel/fork.c:172 [inline] dup_task_struct kernel/fork.c:970 [inline] copy_process+0x46a/0x6960 kernel/fork.c:2069 kernel_clone+0xb8/0x7f0 kernel/fork.c:2640 __do_sys_clone+0xaf/0xf0 kernel/fork.c:2757 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 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:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3328 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3423 free_contig_range+0xb1/0x180 mm/page_alloc.c:9418 destroy_args+0x7e/0x503 mm/debug_vm_pgtable.c:1018 debug_vm_pgtable+0x1fc8/0x204c mm/debug_vm_pgtable.c:1332 do_one_initcall+0xbe/0x440 init/main.c:1298 do_initcall_level init/main.c:1371 [inline] do_initcalls init/main.c:1387 [inline] do_basic_setup init/main.c:1406 [inline] kernel_init_freeable+0x5ab/0x605 init/main.c:1613 kernel_init+0x14/0x130 init/main.c:1502 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Memory state around the buggy address: ffff88806a383d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806a383e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806a383e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806a383f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806a383f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================