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 97e9c8eb4bb1dc57859acb1338dfddbd967d7484 testing commit 97e9c8eb4bb1dc57859acb1338dfddbd967d7484 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 25c79ffd19bca85b04221a1eeb7f3a50a87ed4d487848d89d89e450feaf030b6 all runs: crashed: KASAN: slab-out-of-bounds Read in __htab_map_lookup_and_delete_batch revisions tested: 2, total time: 18m50.915530324s (build: 12m16.553618815s, test: 5m53.90428798s) the crash still happens on HEAD commit msg: Merge tag 'perf-tools-fixes-for-v5.17-2022-03-19' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux 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 ffff888140dd8d00 by task syz-executor158/4125 CPU: 1 PID: 4125 Comm: syz-executor158 Not tainted 5.17.0-rc8-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/0x1410 kernel/bpf/hashtab.c:1768 bpf_map_do_batch+0x1f5/0x420 kernel/bpf/syscall.c:4225 __sys_bpf+0x161f/0x4400 kernel/bpf/syscall.c:4697 __do_sys_bpf kernel/bpf/syscall.c:4741 [inline] __se_sys_bpf kernel/bpf/syscall.c:4739 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4739 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:0x7f1c6b3bcb79 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:00007f1c6b34d2f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f1c6b4453f0 RCX: 00007f1c6b3bcb79 RDX: 0000000000000038 RSI: 0000000020000080 RDI: 0000000000000019 RBP: 00007f1c6b4128e0 R08: 00007f1c6b34d700 R09: 0000000000000000 R10: 00007f1c6b34d700 R11: 0000000000000246 R12: 00000000200031c0 R13: 00007f1c6b412068 R14: 00000000200021c0 R15: 00007f1c6b4453f8 Allocated by task 4125: 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+0x479/0x1410 kernel/bpf/hashtab.c:1647 bpf_map_do_batch+0x1f5/0x420 kernel/bpf/syscall.c:4225 __sys_bpf+0x161f/0x4400 kernel/bpf/syscall.c:4697 __do_sys_bpf kernel/bpf/syscall.c:4741 [inline] __se_sys_bpf kernel/bpf/syscall.c:4739 [inline] __x64_sys_bpf+0x70/0xb0 kernel/bpf/syscall.c:4739 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 ffff888140dd8d00 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff888140dd8d00, ffff888140dd8d40) The buggy address belongs to the page: page:ffffea0005037600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x140dd8 flags: 0x57ff00000000200(slab|node=1|zone=2|lastcpupid=0x7ff) raw: 057ff00000000200 ffffea00005c5e40 dead000000000004 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 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 1, ts 2454578284, free_ts 0 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_page_interleave+0xf/0x1c0 mm/mempolicy.c:2116 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_array include/linux/slab.h:621 [inline] kobj_map+0x6b/0x640 drivers/base/map.c:44 cdev_add+0x82/0x110 fs/char_dev.c:489 tty_cdev_add+0x175/0x290 drivers/tty/tty_io.c:3161 tty_register_device_attr+0x3e8/0x6d0 drivers/tty/tty_io.c:3268 tty_register_device drivers/tty/tty_io.c:3188 [inline] tty_register_driver+0x37a/0x6e0 drivers/tty/tty_io.c:3453 vty_init+0x2e1/0x306 drivers/tty/vt/vt.c:3616 tty_init+0x11a/0x11d drivers/tty/tty_io.c:3608 do_one_initcall+0xbe/0x440 init/main.c:1300 do_initcall_level init/main.c:1373 [inline] do_initcalls init/main.c:1389 [inline] do_basic_setup init/main.c:1408 [inline] kernel_init_freeable+0x5ab/0x605 init/main.c:1613 page_owner free stack trace missing Memory state around the buggy address: ffff888140dd8c00: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888140dd8c80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc >ffff888140dd8d00: 00 00 00 00 03 fc fc fc fc fc fc fc fc fc fc fc ^ ffff888140dd8d80: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ffff888140dd8e00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ==================================================================