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 b3d971ec25346d6890e9e8f05b63f758cfcef8c5 testing commit b3d971ec25346d6890e9e8f05b63f758cfcef8c5 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: b28f4157dcee71b558aa9f8e5b5567b5ee837bcbc326e0718ac802ea864421f7 all runs: crashed: KASAN: slab-out-of-bounds Read in __htab_map_lookup_and_delete_batch revisions tested: 2, total time: 21m3.59360748s (build: 13m42.62335247s, test: 6m47.718942102s) the crash still happens on HEAD commit msg: Merge tag 'drm-fixes-2022-02-18' of git://anongit.freedesktop.org/drm/drm 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+0x5c/0xc0 lib/usercopy.c:26 Read of size 42 at addr ffff888075280680 by task syz-executor410/3953 CPU: 1 PID: 3953 Comm: syz-executor410 Not tainted 5.17.0-rc4-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+0x8d/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 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+0x5c/0xc0 lib/usercopy.c:26 copy_to_user include/linux/uaccess.h:200 [inline] __htab_map_lookup_and_delete_batch+0xb71/0x1460 kernel/bpf/hashtab.c:1768 bpf_map_do_batch+0x1f5/0x420 kernel/bpf/syscall.c:4222 __sys_bpf+0x161f/0x4400 kernel/bpf/syscall.c:4694 __do_sys_bpf kernel/bpf/syscall.c:4738 [inline] __se_sys_bpf kernel/bpf/syscall.c:4736 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4736 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f38e1430b79 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:00007f38e13c12f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f38e14b93f0 RCX: 00007f38e1430b79 RDX: 0000000000000038 RSI: 0000000020000080 RDI: 0000000000000019 RBP: 00007f38e14868e0 R08: 00007f38e13c1700 R09: 0000000000000000 R10: 00007f38e13c1700 R11: 0000000000000246 R12: 00000000200031c0 R13: 00007f38e1486068 R14: 00000000200021c0 R15: 00007f38e14b93f8 Allocated by task 3953: 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:732 [inline] kvmalloc_array include/linux/slab.h:750 [inline] __htab_map_lookup_and_delete_batch+0x479/0x1460 kernel/bpf/hashtab.c:1647 bpf_map_do_batch+0x1f5/0x420 kernel/bpf/syscall.c:4222 __sys_bpf+0x161f/0x4400 kernel/bpf/syscall.c:4694 __do_sys_bpf kernel/bpf/syscall.c:4738 [inline] __se_sys_bpf kernel/bpf/syscall.c:4736 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4736 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888075280680 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff888075280680, ffff8880752806c0) The buggy address belongs to the page: page:ffffea0001d4a000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x75280 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff88800fc41640 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 0x112c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 2968, ts 92475092272, free_ts 92127107028 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa6f/0x2f10 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x27f/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0xbe3/0x12a0 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x372/0x450 mm/slub.c:4420 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:715 [inline] tomoyo_encode2.part.0+0x92/0x310 security/tomoyo/realpath.c:45 tomoyo_realpath_from_path+0x140/0x6a0 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x1fb/0x350 security/tomoyo/file.c:822 security_path_truncate+0xab/0x100 security/security.c:1203 handle_truncate fs/namei.c:3130 [inline] do_open fs/namei.c:3480 [inline] path_openat+0x121b/0x2390 fs/namei.c:3609 do_filp_open+0x199/0x3d0 fs/namei.c:3636 do_sys_openat2+0x11e/0x400 fs/open.c:1214 do_sys_open fs/open.c:1230 [inline] __do_sys_openat fs/open.c:1246 [inline] __se_sys_openat fs/open.c:1241 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1241 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3404 __unfreeze_partials+0x320/0x340 mm/slub.c:2536 qlink_free mm/kasan/quarantine.c:157 [inline] qlist_free_all+0x6d/0x160 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] __kmalloc+0x256/0x450 mm/slub.c:4420 kmalloc include/linux/slab.h:586 [inline] kzalloc include/linux/slab.h:715 [inline] tomoyo_get_name+0x1b7/0x3f0 security/tomoyo/memory.c:173 tomoyo_assign_domain+0x260/0x600 security/tomoyo/domain.c:569 tomoyo_find_next_domain+0x5f1/0x1c50 security/tomoyo/domain.c:847 tomoyo_bprm_check_security security/tomoyo/tomoyo.c:101 [inline] tomoyo_bprm_check_security+0xfb/0x170 security/tomoyo/tomoyo.c:91 security_bprm_check+0x34/0x70 security/security.c:866 search_binary_handler fs/exec.c:1715 [inline] exec_binprm fs/exec.c:1768 [inline] bprm_execve fs/exec.c:1837 [inline] bprm_execve+0x5da/0x1520 fs/exec.c:1799 kernel_execve+0x2c2/0x3e0 fs/exec.c:1980 call_usermodehelper_exec_async+0x2c1/0x500 kernel/umh.c:112 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff888075280580: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888075280600: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff888075280680: 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc fc ^ ffff888075280700: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff888075280780: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================