================================================================== BUG: KASAN: use-after-free in do_shrink_slab+0xb15/0xbd0 mm/vmscan.c:774 Read of size 8 at addr ffff8880116b45b8 by task udevd/3131 CPU: 2 PID: 3131 Comm: udevd Not tainted 6.0.0-syzkaller-09413-g4899a36f91a9 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x6e9 mm/kasan/report.c:433 kasan_report+0xb1/0x1e0 mm/kasan/report.c:495 do_shrink_slab+0xb15/0xbd0 mm/vmscan.c:774 shrink_slab+0x17c/0x6f0 mm/vmscan.c:991 shrink_node_memcgs mm/vmscan.c:3182 [inline] shrink_node+0x8c9/0x1e80 mm/vmscan.c:3304 shrink_zones mm/vmscan.c:3542 [inline] do_try_to_free_pages+0x3b4/0x17a0 mm/vmscan.c:3601 try_to_free_pages+0x2a7/0x840 mm/vmscan.c:3836 __perform_reclaim mm/page_alloc.c:4750 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:4772 [inline] __alloc_pages_slowpath.constprop.0+0x88a/0x2300 mm/page_alloc.c:5177 __alloc_pages+0x43d/0x510 mm/page_alloc.c:5562 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2270 folio_alloc+0x1c/0x70 mm/mempolicy.c:2280 filemap_alloc_folio+0x306/0x3a0 mm/filemap.c:970 __filemap_get_folio+0x328/0xed0 mm/filemap.c:1970 filemap_fault+0x16d5/0x2640 mm/filemap.c:3137 __do_fault+0x10d/0x610 mm/memory.c:4173 do_read_fault mm/memory.c:4524 [inline] do_fault mm/memory.c:4653 [inline] handle_pte_fault mm/memory.c:4917 [inline] __handle_mm_fault+0x2130/0x39b0 mm/memory.c:5059 handle_mm_fault+0x1c8/0x780 mm/memory.c:5157 do_user_addr_fault+0x475/0x1210 arch/x86/mm/fault.c:1407 handle_page_fault arch/x86/mm/fault.c:1498 [inline] exc_page_fault+0x94/0x170 arch/x86/mm/fault.c:1554 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x7fe7b34c8511 Code: Unable to access opcode bytes at 0x7fe7b34c84e7. RSP: 002b:00007ffc17636750 EFLAGS: 00010206 RAX: 000055cf5b5a83b0 RBX: 000055cf5b48c72e RCX: 00007fe7b3525697 RDX: 0000000000000004 RSI: 00007fe7b35bc71e RDI: 000055cf5b48c72f RBP: 000055cf5b5a83b0 R08: 0000000000000004 R09: 0000000000000001 R10: 00000000000001b6 R11: 0000000000000246 R12: 000055cf5b5a83b0 R13: 000055cf5b5a83b0 R14: 0000000000000001 R15: 0000000000000000 Allocated by task 18747: 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:437 [inline] ____kasan_kmalloc mm/kasan/common.c:516 [inline] ____kasan_kmalloc mm/kasan/common.c:475 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:525 kasan_kmalloc include/linux/kasan.h:234 [inline] __do_kmalloc mm/slab.c:3686 [inline] __kmalloc+0x1f9/0x4a0 mm/slab.c:3695 kmalloc include/linux/slab.h:605 [inline] kzalloc include/linux/slab.h:733 [inline] ops_init+0xfb/0x470 net/core/net_namespace.c:124 setup_net+0x5d1/0xc50 net/core/net_namespace.c:325 copy_net_ns+0x318/0x760 net/core/net_namespace.c:471 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 copy_process+0x304d/0x7090 kernel/fork.c:2257 kernel_clone+0xe7/0xab0 kernel/fork.c:2671 __do_sys_clone3+0x1cd/0x2e0 kernel/fork.c:2963 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+0x63/0xcd Freed by task 18747: 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:367 [inline] ____kasan_slab_free+0x13d/0x1a0 mm/kasan/common.c:329 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3418 [inline] kfree+0x173/0x390 mm/slab.c:3786 ops_init+0xcd/0x470 net/core/net_namespace.c:139 setup_net+0x5d1/0xc50 net/core/net_namespace.c:325 copy_net_ns+0x318/0x760 net/core/net_namespace.c:471 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 copy_process+0x304d/0x7090 kernel/fork.c:2257 kernel_clone+0xe7/0xab0 kernel/fork.c:2671 __do_sys_clone3+0x1cd/0x2e0 kernel/fork.c:2963 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+0x63/0xcd The buggy address belongs to the object at ffff8880116b4000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1464 bytes inside of 2048-byte region [ffff8880116b4000, ffff8880116b4800) The buggy address belongs to the physical page: page:ffffea000045ad00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x116b4 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000881648 ffffea000085acc8 ffff888011840800 raw: 0000000000000000 ffff8880116b4000 0000000100000001 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 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 17663, tgid 17642 (syz-executor.3), ts 488348666502, free_ts 488226166393 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x109b/0x2ce0 mm/page_alloc.c:4283 __alloc_pages_slowpath.constprop.0+0x34d/0x2300 mm/page_alloc.c:5084 __alloc_pages+0x43d/0x510 mm/page_alloc.c:5562 __alloc_pages_node include/linux/gfp.h:243 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x360 mm/slab.c:2569 cache_alloc_refill+0x27f/0x380 mm/slab.c:2942 ____cache_alloc mm/slab.c:3018 [inline] ____cache_alloc mm/slab.c:3001 [inline] __do_cache_alloc mm/slab.c:3246 [inline] slab_alloc mm/slab.c:3287 [inline] kmem_cache_alloc_trace+0x362/0x460 mm/slab.c:3557 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] copy_verifier_state+0x827/0xb80 kernel/bpf/verifier.c:1211 push_stack+0x1d2/0x560 kernel/bpf/verifier.c:1287 check_cond_jmp_op kernel/bpf/verifier.c:10223 [inline] do_check kernel/bpf/verifier.c:12450 [inline] do_check_common+0x6439/0xcc20 kernel/bpf/verifier.c:14642 do_check_main kernel/bpf/verifier.c:14705 [inline] bpf_check+0x8f27/0xc720 kernel/bpf/verifier.c:15275 bpf_prog_load+0x13cb/0x2220 kernel/bpf/syscall.c:2605 __sys_bpf+0x1605/0x4cf0 kernel/bpf/syscall.c:4965 __do_sys_bpf kernel/bpf/syscall.c:5069 [inline] __se_sys_bpf kernel/bpf/syscall.c:5067 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5067 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+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1449 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1499 free_unref_page_prepare mm/page_alloc.c:3380 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3476 slab_destroy mm/slab.c:1615 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1635 cache_flusharray mm/slab.c:3389 [inline] ___cache_free+0x2a8/0x3d0 mm/slab.c:3452 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1b0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 ____kasan_kmalloc mm/kasan/common.c:482 [inline] __kasan_krealloc+0x155/0x190 mm/kasan/common.c:584 kasan_krealloc include/linux/kasan.h:254 [inline] __do_krealloc mm/slab_common.c:1169 [inline] krealloc+0x54/0xf0 mm/slab_common.c:1206 push_jmp_history kernel/bpf/verifier.c:2504 [inline] is_state_visited kernel/bpf/verifier.c:11982 [inline] do_check kernel/bpf/verifier.c:12175 [inline] do_check_common+0x4891/0xcc20 kernel/bpf/verifier.c:14642 do_check_main kernel/bpf/verifier.c:14705 [inline] bpf_check+0x8f27/0xc720 kernel/bpf/verifier.c:15275 bpf_prog_load+0x13cb/0x2220 kernel/bpf/syscall.c:2605 __sys_bpf+0x1605/0x4cf0 kernel/bpf/syscall.c:4965 __do_sys_bpf kernel/bpf/syscall.c:5069 [inline] __se_sys_bpf kernel/bpf/syscall.c:5067 [inline] __x64_sys_bpf+0x75/0xb0 kernel/bpf/syscall.c:5067 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+0x63/0xcd Memory state around the buggy address: ffff8880116b4480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880116b4500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880116b4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880116b4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880116b4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================