================================================================== BUG: KASAN: slab-out-of-bounds in btf_name_valid_section kernel/bpf/btf.c:823 [inline] BUG: KASAN: slab-out-of-bounds in btf_datasec_check_meta+0x8ff/0x910 kernel/bpf/btf.c:4582 Read of size 1 at addr ffff88802b7fd242 by task syz-executor140/5198 CPU: 0 PID: 5198 Comm: syz-executor140 Not tainted 6.10.0-rc3-syzkaller-00044-g2ccbdf43d5e7 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0xc3/0x620 mm/kasan/report.c:488 kasan_report+0xd9/0x110 mm/kasan/report.c:601 btf_name_valid_section kernel/bpf/btf.c:823 [inline] btf_datasec_check_meta+0x8ff/0x910 kernel/bpf/btf.c:4582 btf_check_meta kernel/bpf/btf.c:5064 [inline] btf_check_all_metas kernel/bpf/btf.c:5088 [inline] btf_parse_type_sec kernel/bpf/btf.c:5224 [inline] btf_parse kernel/bpf/btf.c:5616 [inline] btf_new_fd+0x173b/0x4e60 kernel/bpf/btf.c:7482 bpf_btf_load kernel/bpf/syscall.c:5014 [inline] __sys_bpf+0x1632/0x49a0 kernel/bpf/syscall.c:5733 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5793 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fecd957d3a9 Code: 48 83 c4 28 c3 e8 37 17 00 00 0f 1f 80 00 00 00 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:00007ffcd1da1ef8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007ffcd1da20d8 RCX: 00007fecd957d3a9 RDX: 0000000000000020 RSI: 00000000200004c0 RDI: 0000000000000012 RBP: 00007fecd95f0610 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 0000000000000001 R13: 00007ffcd1da20c8 R14: 0000000000000001 R15: 0000000000000001 Allocated by task 5198: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:370 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:387 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slub.c:4122 [inline] __kmalloc_node_noprof+0x215/0x440 mm/slub.c:4129 kmalloc_node_noprof include/linux/slab.h:681 [inline] kvmalloc_node_noprof+0x9d/0x1a0 mm/util.c:634 btf_parse kernel/bpf/btf.c:5592 [inline] btf_new_fd+0x620/0x4e60 kernel/bpf/btf.c:7482 bpf_btf_load kernel/bpf/syscall.c:5014 [inline] __sys_bpf+0x1632/0x49a0 kernel/bpf/syscall.c:5733 __do_sys_bpf kernel/bpf/syscall.c:5795 [inline] __se_sys_bpf kernel/bpf/syscall.c:5793 [inline] __x64_sys_bpf+0x78/0xc0 kernel/bpf/syscall.c:5793 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88802b7fd200 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 0 bytes to the right of allocated 66-byte region [ffff88802b7fd200, ffff88802b7fd242) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2b7fd flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffefff(slab) raw: 00fff00000000000 ffff888015442280 ffffea00008d7680 dead000000000002 raw: 0000000000000000 0000000080200020 00000001ffffefff 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 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 4703, tgid 4703 (udevd), ts 27627099434, free_ts 22661023791 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1468 prep_new_page mm/page_alloc.c:1476 [inline] get_page_from_freelist+0x136a/0x2e50 mm/page_alloc.c:3420 __alloc_pages_noprof+0x22b/0x2460 mm/page_alloc.c:4678 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] alloc_slab_page+0x56/0x110 mm/slub.c:2265 allocate_slab mm/slub.c:2428 [inline] new_slab+0x84/0x260 mm/slub.c:2481 ___slab_alloc+0xdac/0x1870 mm/slub.c:3667 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3757 __slab_alloc_node mm/slub.c:3810 [inline] slab_alloc_node mm/slub.c:3989 [inline] __do_kmalloc_node mm/slub.c:4121 [inline] __kmalloc_noprof+0x36d/0x410 mm/slub.c:4135 kmalloc_noprof include/linux/slab.h:664 [inline] kzalloc_noprof include/linux/slab.h:778 [inline] tomoyo_encode2+0x100/0x3e0 security/tomoyo/realpath.c:45 tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x19d/0x720 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x273/0x450 security/tomoyo/file.c:822 security_inode_getattr+0xf4/0x160 security/security.c:2269 vfs_getattr fs/stat.c:173 [inline] vfs_fstat+0x53/0xd0 fs/stat.c:198 vfs_fstatat+0x134/0x150 fs/stat.c:300 __do_sys_newfstatat+0xa6/0x130 fs/stat.c:468 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1088 [inline] free_unref_page+0x64a/0xe40 mm/page_alloc.c:2583 kasan_depopulate_vmalloc_pte+0x63/0x80 mm/kasan/shadow.c:408 apply_to_pte_range mm/memory.c:2752 [inline] apply_to_pmd_range mm/memory.c:2796 [inline] apply_to_pud_range mm/memory.c:2832 [inline] apply_to_p4d_range mm/memory.c:2868 [inline] __apply_to_page_range+0x795/0xdd0 mm/memory.c:2902 kasan_release_vmalloc+0xac/0xc0 mm/kasan/shadow.c:525 purge_vmap_node+0x3fc/0x920 mm/vmalloc.c:2207 __purge_vmap_area_lazy+0x9ca/0xc10 mm/vmalloc.c:2289 _vm_unmap_aliases+0x29c/0xbd0 mm/vmalloc.c:2867 change_page_attr_set_clr+0x24c/0x490 arch/x86/mm/pat/set_memory.c:1882 change_page_attr_clear arch/x86/mm/pat/set_memory.c:1930 [inline] set_memory_ro+0x7c/0xb0 arch/x86/mm/pat/set_memory.c:2116 bpf_prog_lock_ro include/linux/filter.h:929 [inline] bpf_prog_select_runtime+0x59d/0x6f0 kernel/bpf/core.c:2423 bpf_prog_load+0xf0f/0x2660 kernel/bpf/syscall.c:2912 __sys_bpf+0x8e9/0x49a0 kernel/bpf/syscall.c:5688 ____bpf_sys_bpf kernel/bpf/syscall.c:5826 [inline] kern_sys_bpf+0x58/0x70 kernel/bpf/syscall.c:5874 skel_sys_bpf tools/lib/bpf/skel_internal.h:75 [inline] bpf_load_and_run.constprop.0+0x28c/0x5e0 tools/lib/bpf/skel_internal.h:341 iterators_bpf__load kernel/bpf/preload/iterators/iterators.lskel-little-endian.h:403 [inline] load_skel kernel/bpf/preload/bpf_preload_kern.c:45 [inline] load+0x147/0x5d0 kernel/bpf/preload/bpf_preload_kern.c:78 do_one_initcall+0x128/0x700 init/main.c:1267 Memory state around the buggy address: ffff88802b7fd100: 00 00 00 00 00 00 00 00 06 fc fc fc fc fc fc fc ffff88802b7fd180: 00 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc >ffff88802b7fd200: 00 00 00 00 00 00 00 00 02 fc fc fc fc fc fc fc ^ ffff88802b7fd280: 00 00 00 00 00 00 00 00 00 00 01 fc fc fc fc fc ffff88802b7fd300: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================