================================================================== BUG: KASAN: slab-out-of-bounds in copy_array kernel/bpf/verifier.c:1072 [inline] BUG: KASAN: slab-out-of-bounds in copy_verifier_state+0x130/0xbe0 kernel/bpf/verifier.c:1250 Write of size 40 at addr ffff8880750d8780 by task syz-executor.5/4343 CPU: 1 PID: 4343 Comm: syz-executor.5 Not tainted 6.2.0-rc2-syzkaller-00010-g69b41ac87e4a #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_address_description+0x74/0x340 mm/kasan/report.c:306 print_report+0x107/0x220 mm/kasan/report.c:417 kasan_report+0x139/0x170 mm/kasan/report.c:517 kasan_check_range+0x2a7/0x2e0 mm/kasan/generic.c:189 memcpy+0x3c/0x60 mm/kasan/shadow.c:66 copy_array kernel/bpf/verifier.c:1072 [inline] copy_verifier_state+0x130/0xbe0 kernel/bpf/verifier.c:1250 pop_stack kernel/bpf/verifier.c:1314 [inline] do_check+0x8e51/0x107b0 kernel/bpf/verifier.c:14031 do_check_common+0x909/0x1800 kernel/bpf/verifier.c:16289 do_check_main kernel/bpf/verifier.c:16352 [inline] bpf_check+0x107e2/0x16170 kernel/bpf/verifier.c:16936 bpf_prog_load+0x1306/0x1be0 kernel/bpf/syscall.c:2619 __sys_bpf+0x396/0x6d0 kernel/bpf/syscall.c:4979 __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] __se_sys_bpf kernel/bpf/syscall.c:5081 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5081 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f084b28c0a9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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:00007f084bfd5168 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f084b3abf80 RCX: 00007f084b28c0a9 RDX: 0000000000000048 RSI: 00000000200054c0 RDI: 0000000000000005 RBP: 00007f084b2e7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fff9a53954f R14: 00007f084bfd5300 R15: 0000000000022000 Allocated by task 4343: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] __kasan_krealloc+0xbf/0xf0 mm/kasan/common.c:439 kasan_krealloc include/linux/kasan.h:231 [inline] __do_krealloc mm/slab_common.c:1361 [inline] krealloc+0xb2/0x110 mm/slab_common.c:1398 push_jmp_history kernel/bpf/verifier.c:2592 [inline] is_state_visited kernel/bpf/verifier.c:13552 [inline] do_check+0x9433/0x107b0 kernel/bpf/verifier.c:13752 do_check_common+0x909/0x1800 kernel/bpf/verifier.c:16289 do_check_main kernel/bpf/verifier.c:16352 [inline] bpf_check+0x107e2/0x16170 kernel/bpf/verifier.c:16936 bpf_prog_load+0x1306/0x1be0 kernel/bpf/syscall.c:2619 __sys_bpf+0x396/0x6d0 kernel/bpf/syscall.c:4979 __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] __se_sys_bpf kernel/bpf/syscall.c:5081 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5081 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:488 kvfree_call_rcu+0x118/0x8c0 kernel/rcu/tree.c:3376 __dentry_kill+0x418/0x5b0 fs/dcache.c:612 dentry_kill+0xbb/0x290 dput+0x1f3/0x410 fs/dcache.c:913 do_one_tree fs/dcache.c:1685 [inline] shrink_dcache_for_umount+0xb1/0x1a0 fs/dcache.c:1699 generic_shutdown_super+0x63/0x310 fs/super.c:473 kill_anon_super+0x36/0x60 fs/super.c:1086 deactivate_locked_super+0xa7/0xf0 fs/super.c:332 cleanup_mnt+0x494/0x520 fs/namespace.c:1291 task_work_run+0x243/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x134/0x160 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8880750d8780 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff8880750d8780, ffff8880750d87c0) The buggy address belongs to the physical page: page:ffffea0001d43600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x750d8 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffff888012841640 ffffea0000796040 dead000000000004 raw: 0000000000000000 0000000000200020 00000001ffffffff 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 6766, tgid 6758 (syz-executor.1), ts 1866731244620, free_ts 1866707985210 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5549 alloc_slab_page+0xbd/0x190 mm/slub.c:1851 allocate_slab+0x5e/0x3c0 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0x7f4/0xeb0 mm/slub.c:3193 __slab_alloc mm/slub.c:3292 [inline] __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x25b/0x340 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc+0x9e/0x190 mm/slab_common.c:981 xfrm_policy_init net/xfrm/xfrm_policy.c:4124 [inline] xfrm_net_init+0x601/0xe60 net/xfrm/xfrm_policy.c:4212 ops_init+0x353/0x5d0 net/core/net_namespace.c:135 setup_net+0x60b/0xd80 net/core/net_namespace.c:333 copy_net_ns+0x34c/0x5a0 net/core/net_namespace.c:483 create_new_namespaces+0x4db/0x8e0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x180 kernel/nsproxy.c:228 ksys_unshare+0x57f/0xb30 kernel/fork.c:3202 __do_sys_unshare kernel/fork.c:3273 [inline] __se_sys_unshare kernel/fork.c:3271 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3271 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x751/0x780 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page_list+0xb2/0x830 mm/page_alloc.c:3510 release_pages+0x234e/0x25f0 mm/swap.c:1076 tlb_batch_pages_flush mm/mmu_gather.c:97 [inline] tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu+0x860/0xa80 mm/mmu_gather.c:299 tlb_finish_mmu+0xcd/0x200 mm/mmu_gather.c:391 exit_mmap+0x2b1/0x670 mm/mmap.c:3096 __mmput+0x114/0x3b0 kernel/fork.c:1207 exit_mm+0x20f/0x2f0 kernel/exit.c:563 do_exit+0x5c7/0x2150 kernel/exit.c:854 do_group_exit+0x1fd/0x2b0 kernel/exit.c:1012 get_signal+0x1755/0x1820 kernel/signal.c:2859 arch_do_signal_or_restart+0x8d/0x5f0 arch/x86/kernel/signal.c:306 exit_to_user_mode_loop+0x74/0x160 kernel/entry/common.c:168 exit_to_user_mode_prepare+0xad/0x110 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x2e/0x60 kernel/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff8880750d8680: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880750d8700: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff8880750d8780: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880750d8800: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff8880750d8880: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================