bisecting fixing commit since 0c88e405c97ed1828443b67891e6d4bb6e56cd4e building syzkaller on b3a34598c6b285e38fc13f95c8db997a84815085 testing commit 0c88e405c97ed1828443b67891e6d4bb6e56cd4e compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 4730663e8c71f03f7bc06d3473fc4c9224fcb80d4560963a25ef199f03c9ba80 run #0: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #1: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #2: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #3: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #4: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #5: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #6: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #7: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #8: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #9: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #10: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #11: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #12: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #13: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #14: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #15: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #16: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #17: OK run #18: OK run #19: OK testing current HEAD 2950c9c5e0df6bd34af45a5168bbee345e95eae2 testing commit 2950c9c5e0df6bd34af45a5168bbee345e95eae2 compiler: gcc version 8.4.1 20210217 (GCC) kernel signature: 0b0fa60d5e6c6ef8f89f23ceabac68008d9aaf021e6d81944ed33414bac1bc96 run #0: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #1: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #2: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #3: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #4: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #5: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #6: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #7: crashed: KASAN: use-after-free Read in bpf_tcp_remove run #8: OK run #9: OK revisions tested: 2, total time: 38m49.476454491s (build: 18m50.855958942s, test: 19m27.360763584s) the crash still happens on HEAD commit msg: Linux 4.19.207 crash: KASAN: use-after-free Read in bpf_tcp_remove Bluetooth: hci4: command 0x0406 tx timeout Bluetooth: hci3: command 0x0406 tx timeout Bluetooth: hci0: command 0x0406 tx timeout ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x31e7/0x47c0 kernel/locking/lockdep.c:3295 Read of size 8 at addr ffff8880a5a26938 by task syz-executor.4/24226 CPU: 0 PID: 24226 Comm: syz-executor.4 Not tainted 4.19.207-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x17c/0x226 lib/dump_stack.c:118 print_address_description.cold.6+0x9/0x211 mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report mm/kasan/report.c:412 [inline] kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:396 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 __lock_acquire+0x31e7/0x47c0 kernel/locking/lockdep.c:3295 lock_acquire+0x180/0x3a0 kernel/locking/lockdep.c:3908 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 bpf_tcp_remove+0x3e8/0x920 kernel/bpf/sockmap.c:335 bpf_tcp_close+0xd2/0x280 kernel/bpf/sockmap.c:403 inet_release+0xb4/0x1b0 net/ipv4/af_inet.c:427 inet6_release+0x46/0x60 net/ipv6/af_inet6.c:472 __sock_release+0xc2/0x290 net/socket.c:599 sock_close+0x10/0x20 net/socket.c:1214 __fput+0x249/0x7f0 fs/file_table.c:278 ____fput+0x9/0x10 fs/file_table.c:309 task_work_run+0x108/0x180 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:193 [inline] exit_to_usermode_loop+0x185/0x1e0 arch/x86/entry/common.c:167 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline] syscall_return_slowpath arch/x86/entry/common.c:271 [inline] do_syscall_64+0x413/0x4e0 arch/x86/entry/common.c:296 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x418b9b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffffcb48cc0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000006 RCX: 0000000000418b9b RDX: 0000000000000000 RSI: 0000000000561118 RDI: 0000000000000005 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 00007ffffcb48db0 R11: 0000000000000293 R12: 00000000000003e8 R13: 000000000002af88 R14: 000000000055bf00 R15: 000000000055bfa8 Allocated by task 24236: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:553 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:538 kmem_cache_alloc_trace+0x152/0x3a0 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] sock_map_alloc kernel/bpf/sockmap.c:1675 [inline] sock_map_alloc+0x16d/0x370 kernel/bpf/sockmap.c:1657 find_and_alloc_map kernel/bpf/syscall.c:130 [inline] map_create kernel/bpf/syscall.c:510 [inline] __do_sys_bpf kernel/bpf/syscall.c:2408 [inline] __se_sys_bpf+0x38a/0x2bf0 kernel/bpf/syscall.c:2384 __x64_sys_bpf+0x6e/0xb0 kernel/bpf/syscall.c:2384 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 22416: save_stack mm/kasan/kasan.c:448 [inline] set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x13c/0x220 mm/kasan/kasan.c:521 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528 __cache_free mm/slab.c:3503 [inline] kfree+0xcf/0x220 mm/slab.c:3822 sock_map_remove_complete kernel/bpf/sockmap.c:1583 [inline] sock_map_free+0x26c/0x350 kernel/bpf/sockmap.c:1778 bpf_map_free_deferred+0xaf/0xe0 kernel/bpf/syscall.c:291 process_one_work+0x7b9/0x15a0 kernel/workqueue.c:2153 worker_thread+0x85/0xb60 kernel/workqueue.c:2296 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 The buggy address belongs to the object at ffff8880a5a26800 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 312 bytes inside of 512-byte region [ffff8880a5a26800, ffff8880a5a26a00) The buggy address belongs to the page: page:ffffea0002968980 count:1 mapcount:0 mapping:ffff88813bff6940 index:0xffff8880a5a26080 flags: 0xfff00000000100(slab) raw: 00fff00000000100 ffffea000284de88 ffffea00028517c8 ffff88813bff6940 raw: ffff8880a5a26080 ffff8880a5a26080 0000000100000004 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8880a5a26800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a5a26880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880a5a26900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880a5a26980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880a5a26a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================