================================================================== BUG: KASAN: slab-out-of-bounds in copy_array+0x96/0x100 kernel/bpf/verifier.c:1072 Write of size 32 at addr ffff88807612ce00 by task syz-executor.4/7981 CPU: 0 PID: 7981 Comm: syz-executor.4 Not tainted 6.1.0-syzkaller-14011-gd75858ef108c #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+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x45d mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x141/0x190 mm/kasan/generic.c:189 memcpy+0x3d/0x60 mm/kasan/shadow.c:66 copy_array+0x96/0x100 kernel/bpf/verifier.c:1072 copy_verifier_state+0xa9/0xc60 kernel/bpf/verifier.c:1250 pop_stack+0x8c/0x2f0 kernel/bpf/verifier.c:1314 do_check kernel/bpf/verifier.c:14042 [inline] do_check_common+0x5663/0xbca0 kernel/bpf/verifier.c:16300 do_check_main kernel/bpf/verifier.c:16363 [inline] bpf_check+0x7348/0xacc0 kernel/bpf/verifier.c:16947 bpf_prog_load+0x1543/0x2230 kernel/bpf/syscall.c:2619 __sys_bpf+0x1435/0x5000 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+0x79/0xc0 kernel/bpf/syscall.c:5081 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7fe232e8c0c9 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:00007fe2319fe168 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fe232fabf80 RCX: 00007fe232e8c0c9 RDX: 0000000000000048 RSI: 00000000200054c0 RDI: 0000000000000005 RBP: 00007fe232ee7ae9 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd7dd9b57f R14: 00007fe2319fe300 R15: 0000000000022000 Allocated by task 7981: kasan_save_stack+0x22/0x40 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_krealloc+0x145/0x180 mm/kasan/common.c:439 kasan_krealloc include/linux/kasan.h:231 [inline] __do_krealloc mm/slab_common.c:1361 [inline] krealloc+0xa8/0x100 mm/slab_common.c:1398 push_jmp_history+0x13e/0x330 kernel/bpf/verifier.c:2596 do_check kernel/bpf/verifier.c:13782 [inline] do_check_common+0xa68/0xbca0 kernel/bpf/verifier.c:16300 do_check_main kernel/bpf/verifier.c:16363 [inline] bpf_check+0x7348/0xacc0 kernel/bpf/verifier.c:16947 bpf_prog_load+0x1543/0x2230 kernel/bpf/syscall.c:2619 __sys_bpf+0x1435/0x5000 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+0x79/0xc0 kernel/bpf/syscall.c:5081 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff88807612ce00 which belongs to the cache kmalloc-128 of size 128 The buggy address is located 0 bytes inside of 128-byte region [ffff88807612ce00, ffff88807612ce80) The buggy address belongs to the physical page: page:ffffea0001d84b00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7612c flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffff8880124418c0 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080100010 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 5085, tgid 5085 (syz-executor.2), ts 84983254004, free_ts 84983042448 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283 __alloc_pages+0x1cb/0x5b0 mm/page_alloc.c:5549 __alloc_pages_node include/linux/gfp.h:237 [inline] alloc_slab_page mm/slub.c:1853 [inline] allocate_slab+0xa7/0x350 mm/slub.c:1998 new_slab mm/slub.c:2051 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3193 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0x1a4/0x430 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc_node+0x4d/0xd0 mm/slab_common.c:975 kmalloc_array_node include/linux/slab.h:697 [inline] kcalloc_node include/linux/slab.h:702 [inline] memcg_alloc_slab_cgroups+0x8f/0x150 mm/memcontrol.c:2892 memcg_slab_post_alloc_hook+0xaa/0x480 mm/slab.h:538 slab_post_alloc_hook mm/slab.h:769 [inline] slab_alloc_node mm/slub.c:3452 [inline] __kmem_cache_alloc_node+0x218/0x430 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc_node+0x4d/0xd0 mm/slab_common.c:975 kmalloc_node include/linux/slab.h:610 [inline] kvmalloc_node+0xa2/0x1a0 mm/util.c:581 kvmalloc include/linux/slab.h:737 [inline] kvzalloc include/linux/slab.h:745 [inline] allocate_hook_entries_size net/netfilter/core.c:61 [inline] nf_hook_entries_grow+0x140/0x780 net/netfilter/core.c:128 __nf_register_net_hook+0x14d/0x880 net/netfilter/core.c:423 nf_register_net_hook+0x118/0x170 net/netfilter/core.c:566 nf_register_net_hooks+0x5d/0xc0 net/netfilter/core.c:582 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+0x65c/0xc00 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3464 __vunmap+0x85d/0xd30 mm/vmalloc.c:2727 __vfree+0x3c/0xd0 mm/vmalloc.c:2775 vfree+0x5e/0x90 mm/vmalloc.c:2806 copy_entries_to_user net/ipv4/netfilter/ip_tables.c:868 [inline] get_entries net/ipv4/netfilter/ip_tables.c:1024 [inline] do_ipt_get_ctl+0x802/0x9e0 net/ipv4/netfilter/ip_tables.c:1663 nf_getsockopt+0x76/0xd0 net/netfilter/nf_sockopt.c:116 ip_getsockopt+0x189/0x1e0 net/ipv4/ip_sockglue.c:1797 tcp_getsockopt+0x99/0x100 net/ipv4/tcp.c:4406 __sys_getsockopt+0x21a/0x6a0 net/socket.c:2290 __do_sys_getsockopt net/socket.c:2305 [inline] __se_sys_getsockopt net/socket.c:2302 [inline] __x64_sys_getsockopt+0xbe/0x160 net/socket.c:2302 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff88807612cd00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88807612cd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807612ce00: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88807612ce80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807612cf00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================