================================================================== BUG: KASAN: slab-out-of-bounds in copy_array+0x8a/0xe8 kernel/bpf/verifier.c:1072 Write of size 80 at addr ff6000000e479500 by task syz-executor.1/4846 CPU: 1 PID: 4846 Comm: syz-executor.1 Tainted: G W 6.2.0-rc1-syzkaller #0 Hardware name: riscv-virtio,qemu (DT) Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:121 [] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:127 [] __dump_stack lib/dump_stack.c:88 [inline] [] dump_stack_lvl+0xe0/0x14c lib/dump_stack.c:106 [] print_address_description mm/kasan/report.c:306 [inline] [] print_report+0x1e4/0x4c0 mm/kasan/report.c:417 [] kasan_report+0xb8/0xe6 mm/kasan/report.c:517 [] check_region_inline mm/kasan/generic.c:173 [inline] [] kasan_check_range+0x32/0x148 mm/kasan/generic.c:189 [] memcpy+0x32/0x64 mm/kasan/shadow.c:66 [] copy_array+0x8a/0xe8 kernel/bpf/verifier.c:1072 [] copy_verifier_state+0x6c/0x462 kernel/bpf/verifier.c:1250 [] pop_stack kernel/bpf/verifier.c:1314 [inline] [] do_check kernel/bpf/verifier.c:14031 [inline] [] do_check_common+0x397a/0x6608 kernel/bpf/verifier.c:16289 [] do_check_main kernel/bpf/verifier.c:16352 [inline] [] bpf_check+0x45b2/0x5a5a kernel/bpf/verifier.c:16936 [] bpf_prog_load+0xc90/0x12b0 kernel/bpf/syscall.c:2619 [] __sys_bpf+0x622/0x31d2 kernel/bpf/syscall.c:4979 [] __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] [] sys_bpf+0x28/0x36 kernel/bpf/syscall.c:5081 [] ret_from_syscall+0x0/0x2 Allocated by task 4846: stack_trace_save+0xa6/0xd8 kernel/stacktrace.c:122 kasan_save_stack+0x2c/0x5a mm/kasan/common.c:45 kasan_set_track+0x1a/0x26 mm/kasan/common.c:52 kasan_save_alloc_info+0x1a/0x24 mm/kasan/generic.c:507 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_krealloc+0xfa/0x11a mm/kasan/common.c:439 kasan_krealloc include/linux/kasan.h:231 [inline] __do_krealloc mm/slab_common.c:1361 [inline] krealloc+0x82/0xae mm/slab_common.c:1398 push_jmp_history+0xd2/0x140 kernel/bpf/verifier.c:2592 is_state_visited kernel/bpf/verifier.c:13552 [inline] do_check kernel/bpf/verifier.c:13752 [inline] do_check_common+0x47be/0x6608 kernel/bpf/verifier.c:16289 do_check_main kernel/bpf/verifier.c:16352 [inline] bpf_check+0x45b2/0x5a5a kernel/bpf/verifier.c:16936 bpf_prog_load+0xc90/0x12b0 kernel/bpf/syscall.c:2619 __sys_bpf+0x622/0x31d2 kernel/bpf/syscall.c:4979 __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] sys_bpf+0x28/0x36 kernel/bpf/syscall.c:5081 ret_from_syscall+0x0/0x2 The buggy address belongs to the object at ff6000000e479500 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ff6000000e479500, ff6000000e479560) The buggy address belongs to the physical page: page:ff1c000002399e40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8e679 anon flags: 0xffe000000000200(slab|node=0|zone=0|lastcpupid=0x7ff) raw: 0ffe000000000200 ff60000008201780 ff1c0000024e90c0 0000000000000005 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 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 2806, tgid 2806 (sh), ts 379411146300, free_ts 378502993700 __set_page_owner+0x32/0x182 mm/page_owner.c:190 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0xf8/0x11a mm/page_alloc.c:2524 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0xc0e/0x1118 mm/page_alloc.c:4283 __alloc_pages+0x1b0/0x165a mm/page_alloc.c:5549 alloc_pages+0x132/0x25e mm/mempolicy.c:2286 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab mm/slub.c:1998 [inline] new_slab+0x270/0x382 mm/slub.c:2051 ___slab_alloc+0x57e/0xaa6 mm/slub.c:3193 __slab_alloc.constprop.0+0x5a/0x98 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0xf2/0x2e4 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc+0x34/0xe2 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] kzalloc include/linux/slab.h:720 [inline] tomoyo_commit_ok+0x30/0x9c security/tomoyo/memory.c:76 tomoyo_update_domain+0x118/0x528 security/tomoyo/domain.c:139 tomoyo_update_path_number_acl security/tomoyo/file.c:691 [inline] tomoyo_write_file+0x6a2/0x74e security/tomoyo/file.c:1034 tomoyo_write_domain2+0x102/0x18c security/tomoyo/common.c:1143 tomoyo_add_entry security/tomoyo/common.c:2033 [inline] tomoyo_supervisor+0x364/0xc08 security/tomoyo/common.c:2094 tomoyo_audit_path_number_log security/tomoyo/file.c:235 [inline] tomoyo_path_number_perm+0x3ae/0x43c security/tomoyo/file.c:734 page last free stack trace: __reset_page_owner+0x4a/0xf8 mm/page_owner.c:148 reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x254/0x48e mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page_list+0x11e/0x736 mm/page_alloc.c:3510 release_pages+0x85a/0xbb2 mm/swap.c:1076 free_pages_and_swap_cache+0x76/0x88 mm/swap_state.c:311 tlb_batch_pages_flush+0x86/0x10c mm/mmu_gather.c:97 tlb_flush_mmu_free mm/mmu_gather.c:292 [inline] tlb_flush_mmu mm/mmu_gather.c:299 [inline] tlb_finish_mmu+0xcc/0x280 mm/mmu_gather.c:391 exit_mmap+0x190/0x686 mm/mmap.c:3096 __mmput+0x98/0x290 kernel/fork.c:1207 mmput+0x74/0x88 kernel/fork.c:1229 exec_mmap fs/exec.c:1033 [inline] begin_new_exec+0x984/0x1626 fs/exec.c:1292 load_elf_binary+0x668/0x32b2 fs/binfmt_elf.c:996 search_binary_handler fs/exec.c:1735 [inline] exec_binprm fs/exec.c:1777 [inline] bprm_execve fs/exec.c:1851 [inline] bprm_execve+0x5bc/0x116c fs/exec.c:1808 do_execveat_common+0x476/0x504 fs/exec.c:1956 do_execve fs/exec.c:2030 [inline] __do_sys_execve fs/exec.c:2106 [inline] sys_execve+0x9e/0xbc fs/exec.c:2101 ret_from_syscall+0x0/0x2 Memory state around the buggy address: ff6000000e479400: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ff6000000e479480: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ff6000000e479500: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ff6000000e479580: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc ff6000000e479600: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ==================================================================