bisecting fixing commit since 3f667b5d4053ad54aee13dab5c94f04ff75ddfdf building syzkaller on 44068e196185e2f5a7c94629b6245cdde008b140 testing commit 3f667b5d4053ad54aee13dab5c94f04ff75ddfdf compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 7602b70fbb89813a228ca0cd81c4ac0495ec6965b0162072797bd961447e4cb2 all runs: crashed: KASAN: slab-out-of-bounds Read in __htab_map_lookup_and_delete_batch testing current HEAD b2d229d4ddb17db541098b83524d901257e93845 testing commit b2d229d4ddb17db541098b83524d901257e93845 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: bad82baab9421600db6b67b1c5dad6282c0bdfd6872ec9bb1601a69642118b68 all runs: crashed: KASAN: slab-out-of-bounds Read in __htab_map_lookup_and_delete_batch revisions tested: 2, total time: 18m39.04294412s (build: 12m17.219796968s, test: 5m36.896171561s) the crash still happens on HEAD commit msg: Linux 5.18-rc3 crash: KASAN: slab-out-of-bounds Read in __htab_map_lookup_and_delete_batch ================================================================== BUG: KASAN: slab-out-of-bounds in instrument_copy_to_user include/linux/instrumented.h:118 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user lib/usercopy.c:32 [inline] BUG: KASAN: slab-out-of-bounds in _copy_to_user+0x9c/0xc0 lib/usercopy.c:26 Read of size 42 at addr ffff88807ecff780 by task syz-executor362/4109 CPU: 0 PID: 4109 Comm: syz-executor362 Not tainted 5.18.0-rc3-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_copy_to_user include/linux/instrumented.h:118 [inline] _copy_to_user lib/usercopy.c:32 [inline] _copy_to_user+0x9c/0xc0 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:160 [inline] __htab_map_lookup_and_delete_batch+0xb54/0x13f0 kernel/bpf/hashtab.c:1768 bpf_map_do_batch+0x1ef/0x420 kernel/bpf/syscall.c:4241 __sys_bpf+0x1717/0x4360 kernel/bpf/syscall.c:4723 __do_sys_bpf kernel/bpf/syscall.c:4767 [inline] __se_sys_bpf kernel/bpf/syscall.c:4765 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4765 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fef56ccdb79 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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:00007fef56c5e2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007fef56d563f0 RCX: 00007fef56ccdb79 RDX: 0000000000000038 RSI: 0000000020000080 RDI: 0000000000000019 RBP: 00007fef56d238e0 R08: 00007fef56c5e700 R09: 0000000000000000 R10: 00007fef56c5e700 R11: 0000000000000246 R12: 00000000200031c0 R13: 00007fef56d23068 R14: 00000000200021c0 R15: 00007fef56d563f8 Allocated by task 4109: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kvmalloc include/linux/slab.h:731 [inline] kvmalloc_array include/linux/slab.h:749 [inline] __htab_map_lookup_and_delete_batch+0x468/0x13f0 kernel/bpf/hashtab.c:1647 bpf_map_do_batch+0x1ef/0x420 kernel/bpf/syscall.c:4241 __sys_bpf+0x1717/0x4360 kernel/bpf/syscall.c:4723 __do_sys_bpf kernel/bpf/syscall.c:4767 [inline] __se_sys_bpf kernel/bpf/syscall.c:4765 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4765 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88807ecff780 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff88807ecff780, ffff88807ecff7c0) The buggy address belongs to the physical page: page:ffffea0001fb3fc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ecff flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000882c00 dead000000000005 ffff888010041640 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 2947, tgid 2947 (S02acpid), ts 7197165044, free_ts 7195302794 prep_new_page mm/page_alloc.c:2441 [inline] get_page_from_freelist+0x178d/0x3dc0 mm/page_alloc.c:4182 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5408 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0x8e1/0xf20 mm/slub.c:3005 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3092 slab_alloc_node mm/slub.c:3183 [inline] slab_alloc mm/slub.c:3225 [inline] __kmalloc+0x318/0x350 mm/slub.c:4410 kmalloc include/linux/slab.h:586 [inline] tomoyo_add_entry security/tomoyo/common.c:2022 [inline] tomoyo_supervisor+0xa4b/0xc40 security/tomoyo/common.c:2094 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x252/0x380 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x290/0x2c0 security/tomoyo/file.c:777 security_file_open+0x34/0x80 security/security.c:1651 do_dentry_open+0x300/0xfd0 fs/open.c:811 do_open fs/namei.c:3476 [inline] path_openat+0x9cf/0x2360 fs/namei.c:3609 do_filp_open+0x199/0x3d0 fs/namei.c:3636 do_sys_openat2+0x11e/0x3f0 fs/open.c:1213 do_sys_open fs/open.c:1229 [inline] __do_sys_openat fs/open.c:1245 [inline] __se_sys_openat fs/open.c:1240 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1240 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 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:1356 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1406 free_unref_page_prepare mm/page_alloc.c:3328 [inline] free_unref_page_list+0x16f/0xf80 mm/page_alloc.c:3460 release_pages+0x6f1/0x1780 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:50 [inline] tlb_flush_mmu_free mm/mmu_gather.c:243 [inline] tlb_flush_mmu mm/mmu_gather.c:250 [inline] tlb_finish_mmu+0x127/0x790 mm/mmu_gather.c:341 exit_mmap+0x19d/0x3f0 mm/mmap.c:3150 __mmput+0xed/0x430 kernel/fork.c:1183 exec_mmap fs/exec.c:1034 [inline] begin_new_exec+0xda0/0x29d0 fs/exec.c:1293 load_elf_binary+0xf64/0x4180 fs/binfmt_elf.c:1002 search_binary_handler fs/exec.c:1726 [inline] exec_binprm fs/exec.c:1767 [inline] bprm_execve fs/exec.c:1836 [inline] bprm_execve+0x669/0x14e0 fs/exec.c:1798 do_execveat_common+0x5fd/0x7b0 fs/exec.c:1941 do_execve fs/exec.c:2011 [inline] __do_sys_execve fs/exec.c:2087 [inline] __se_sys_execve fs/exec.c:2082 [inline] __x64_sys_execve+0x8a/0xb0 fs/exec.c:2082 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff88807ecff680: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff88807ecff700: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff88807ecff780: 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc fc ^ ffff88807ecff800: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff88807ecff880: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ==================================================================