================================================================== BUG: KASAN: slab-out-of-bounds in btf_name_valid_section kernel/bpf/btf.c:822 [inline] BUG: KASAN: slab-out-of-bounds in btf_datasec_check_meta+0x250/0x960 kernel/bpf/btf.c:4564 Read of size 1 at addr ffff888117133e37 by task syz-executor.0/2804 CPU: 1 PID: 2804 Comm: syz-executor.0 Not tainted 6.8.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xf8/0x260 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:377 [inline] print_report+0x167/0x540 mm/kasan/report.c:488 kasan_report+0x142/0x180 mm/kasan/report.c:601 btf_name_valid_section kernel/bpf/btf.c:822 [inline] btf_datasec_check_meta+0x250/0x960 kernel/bpf/btf.c:4564 btf_check_meta kernel/bpf/btf.c:5046 [inline] btf_check_all_metas+0x2e9/0x9e0 kernel/bpf/btf.c:5070 btf_parse_type_sec+0x119/0x1470 kernel/bpf/btf.c:5206 btf_parse kernel/bpf/btf.c:5598 [inline] btf_new_fd+0x3b7/0x930 kernel/bpf/btf.c:7450 __sys_bpf+0x5ab/0x650 kernel/bpf/syscall.c:5618 __do_sys_bpf kernel/bpf/syscall.c:5680 [inline] __se_sys_bpf kernel/bpf/syscall.c:5678 [inline] __x64_sys_bpf+0x77/0x90 kernel/bpf/syscall.c:5678 do_syscall_64+0x94/0x1a0 entry_SYSCALL_64_after_hwframe+0x6f/0x77 RIP: 0033:0x7f4fd6c8bda9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4fd680d0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f4fd6db9f80 RCX: 00007f4fd6c8bda9 RDX: 0000000000000020 RSI: 0000000020000300 RDI: 0000000000000012 RBP: 00007f4fd6cd847a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f4fd6db9f80 R15: 00007ffe42692a68 Allocated by task 2804: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3f/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:3981 [inline] __kmalloc_node+0x22f/0x4c0 mm/slub.c:3988 kmalloc_node include/linux/slab.h:610 [inline] kvmalloc_node+0x42/0xf0 mm/util.c:617 kvmalloc include/linux/slab.h:728 [inline] btf_parse kernel/bpf/btf.c:5574 [inline] btf_new_fd+0x250/0x930 kernel/bpf/btf.c:7450 __sys_bpf+0x5ab/0x650 kernel/bpf/syscall.c:5618 __do_sys_bpf kernel/bpf/syscall.c:5680 [inline] __se_sys_bpf kernel/bpf/syscall.c:5678 [inline] __x64_sys_bpf+0x77/0x90 kernel/bpf/syscall.c:5678 do_syscall_64+0x94/0x1a0 entry_SYSCALL_64_after_hwframe+0x6f/0x77 The buggy address belongs to the object at ffff888117133e00 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes to the right of allocated 55-byte region [ffff888117133e00, ffff888117133e37) The buggy address belongs to the physical page: page:ffffea00045c4cc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x117133 anon flags: 0x200000000000800(slab|node=0|zone=2) page_type: 0xffffffff() raw: 0200000000000800 ffff888100041640 ffffea0004582a40 dead000000000003 raw: 0000000000000000 0000000080200020 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1947, tgid 1947 (udevadm), ts 6313674445, free_ts 5444134392 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x10f/0x130 mm/page_alloc.c:1533 prep_new_page mm/page_alloc.c:1540 [inline] get_page_from_freelist+0x33de/0x3580 mm/page_alloc.c:3311 __alloc_pages+0x255/0x650 mm/page_alloc.c:4567 __alloc_pages_node include/linux/gfp.h:238 [inline] alloc_pages_node include/linux/gfp.h:261 [inline] alloc_slab_page+0x5f/0x160 mm/slub.c:2190 allocate_slab mm/slub.c:2354 [inline] new_slab+0x70/0x270 mm/slub.c:2407 ___slab_alloc+0xa79/0x10b0 mm/slub.c:3540 __slab_alloc mm/slub.c:3625 [inline] __slab_alloc_node mm/slub.c:3678 [inline] slab_alloc_node mm/slub.c:3850 [inline] __do_kmalloc_node mm/slub.c:3980 [inline] __kmalloc+0x2ba/0x480 mm/slub.c:3994 kmalloc include/linux/slab.h:594 [inline] kzalloc include/linux/slab.h:711 [inline] kobject_get_path+0x9b/0x1d0 lib/kobject.c:161 kobject_uevent_env+0x2bd/0x6b0 lib/kobject_uevent.c:529 kobject_synth_uevent+0x772/0x910 lib/kobject_uevent.c:208 uevent_store+0x46/0x60 drivers/base/bus.c:633 kernfs_fop_write_iter+0x2f2/0x440 fs/kernfs/file.c:334 call_write_iter include/linux/fs.h:2087 [inline] new_sync_write fs/read_write.c:497 [inline] vfs_write+0xa56/0xe10 fs/read_write.c:590 ksys_write+0x163/0x250 fs/read_write.c:643 do_syscall_64+0x94/0x1a0 entry_SYSCALL_64_after_hwframe+0x6f/0x77 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1140 [inline] free_unref_page_prepare+0x87f/0x9a0 mm/page_alloc.c:2346 free_unref_page+0x37/0x3a0 mm/page_alloc.c:2486 kasan_depopulate_vmalloc_pte+0x74/0x90 mm/kasan/shadow.c:415 apply_to_pte_range mm/memory.c:2619 [inline] apply_to_pmd_range mm/memory.c:2663 [inline] apply_to_pud_range mm/memory.c:2699 [inline] apply_to_p4d_range mm/memory.c:2735 [inline] __apply_to_page_range+0x770/0x8e0 mm/memory.c:2769 kasan_release_vmalloc+0x9a/0xb0 mm/kasan/shadow.c:532 __purge_vmap_area_lazy+0x1324/0x1550 mm/vmalloc.c:1835 _vm_unmap_aliases+0x6aa/0x730 mm/vmalloc.c:2371 change_page_attr_set_clr+0x209/0xcf0 arch/x86/mm/pat/set_memory.c:1838 change_page_attr_set arch/x86/mm/pat/set_memory.c:1879 [inline] set_memory_nx+0xcf/0x110 arch/x86/mm/pat/set_memory.c:2072 free_init_pages arch/x86/mm/init.c:927 [inline] free_kernel_image_pages arch/x86/mm/init.c:946 [inline] free_initmem+0x83/0xf0 arch/x86/mm/init.c:973 kernel_init+0x2c/0x1a0 init/main.c:1450 ret_from_fork+0x32/0x60 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1b/0x30 arch/x86/entry/entry_64.S:243 Memory state around the buggy address: ffff888117133d00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888117133d80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff888117133e00: 00 00 00 00 00 00 07 fc fc fc fc fc fc fc fc fc ^ ffff888117133e80: 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc ffff888117133f00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================