bisecting fixing commit since 961f830af0658ef5ef8a7708786d634a6115f16b building syzkaller on ff51e5229e0ee846d2fd687cb0dbca13de758c66 testing commit 961f830af0658ef5ef8a7708786d634a6115f16b with gcc (GCC) 8.4.1 20210217 kernel signature: 4b5f0fc51e41aa260012e298c54853dc74b3e72340b941d20cfc608f8562ed20 run #0: crashed: KASAN: use-after-free Read in lock_sock_nested run #1: crashed: KASAN: use-after-free Read in lock_sock_nested run #2: crashed: KASAN: use-after-free Read in lock_sock_nested run #3: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #4: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #5: crashed: KASAN: use-after-free Read in lock_sock_nested run #6: crashed: KASAN: use-after-free Read in lock_sock_nested run #7: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #8: crashed: KASAN: use-after-free Read in lock_sock_nested run #9: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #10: crashed: KASAN: use-after-free Read in lock_sock_nested run #11: crashed: KASAN: use-after-free Read in lock_sock_nested run #12: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #13: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #14: crashed: KASAN: use-after-free Read in lock_sock_nested run #15: crashed: KASAN: use-after-free Read in lock_sock_nested run #16: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #17: crashed: KASAN: use-after-free Read in lock_sock_nested run #18: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #19: crashed: KASAN: use-after-free Read in lock_sock_nested testing current HEAD 78fec1611cbf7b0bdaddfdbf174a3a2463663bff testing commit 78fec1611cbf7b0bdaddfdbf174a3a2463663bff with gcc (GCC) 8.4.1 20210217 kernel signature: c08921c318bd08ec2902f81312677124ba8d92883cfb391142073e676ea2a69a run #0: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #1: crashed: KASAN: use-after-free Read in lock_sock_nested run #2: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #3: crashed: KASAN: use-after-free Read in lock_sock_nested run #4: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #5: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #6: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #7: crashed: BUG: unable to handle kernel NULL pointer dereference in l2cap_chan_put run #8: crashed: KASAN: use-after-free Read in lock_sock_nested run #9: crashed: KASAN: use-after-free Read in lock_sock_nested revisions tested: 2, total time: 25m8.934532997s (build: 15m52.399360825s, test: 8m52.770785793s) the crash still happens on HEAD commit msg: Linux 4.19.183 crash: KASAN: use-after-free Read in lock_sock_nested ================================================================== BUG: KASAN: use-after-free in __lock_acquire+0x31e7/0x47c0 kernel/locking/lockdep.c:3294 Read of size 8 at addr ffff8881e28f6b20 by task kworker/1:4/7055 CPU: 1 PID: 7055 Comm: kworker/1:4 Not tainted 4.19.183-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events l2cap_chan_timeout 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:3294 lock_acquire+0x180/0x3a0 kernel/locking/lockdep.c:3907 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:135 [inline] _raw_spin_lock_bh+0x31/0x40 kernel/locking/spinlock.c:168 spin_lock_bh include/linux/spinlock.h:334 [inline] lock_sock_nested+0x3a/0x100 net/core/sock.c:2864 l2cap_sock_teardown_cb+0x87/0x400 net/bluetooth/l2cap_sock.c:1340 l2cap_chan_close+0x3ef/0x830 net/bluetooth/l2cap_core.c:761 l2cap_chan_timeout+0x11d/0x1c0 net/bluetooth/l2cap_core.c:430 process_one_work+0x7b9/0x15a0 kernel/workqueue.c:2152 worker_thread+0x85/0xb60 kernel/workqueue.c:2295 kthread+0x347/0x410 kernel/kthread.c:259 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:415 Allocated by task 8771: 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 __do_kmalloc mm/slab.c:3727 [inline] __kmalloc+0x15d/0x3d0 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] sk_prot_alloc+0x198/0x240 net/core/sock.c:1466 sk_alloc+0x34/0xc70 net/core/sock.c:1520 l2cap_sock_alloc.constprop.4+0x28/0x1e0 net/bluetooth/l2cap_sock.c:1617 l2cap_sock_create+0xb5/0x180 net/bluetooth/l2cap_sock.c:1663 bt_sock_create+0x121/0x260 net/bluetooth/af_bluetooth.c:130 __sock_create+0x262/0x540 net/socket.c:1276 sock_create net/socket.c:1316 [inline] __sys_socket+0xd7/0x1d0 net/socket.c:1346 __do_sys_socket net/socket.c:1355 [inline] __se_sys_socket net/socket.c:1353 [inline] __x64_sys_socket+0x6e/0xb0 net/socket.c:1353 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe Freed by task 8743: 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 sk_prot_free net/core/sock.c:1503 [inline] __sk_destruct+0x452/0x600 net/core/sock.c:1584 sk_destruct+0x83/0xb0 net/core/sock.c:1599 __sk_free+0x9e/0x230 net/core/sock.c:1610 sk_free+0x1a/0x20 net/core/sock.c:1621 sock_put include/net/sock.h:1711 [inline] l2cap_sock_kill.part.2+0x52/0x60 net/bluetooth/l2cap_sock.c:1055 l2cap_sock_kill net/bluetooth/l2cap_sock.c:1215 [inline] l2cap_sock_release+0x1db/0x240 net/bluetooth/l2cap_sock.c:1209 __sock_release+0xc2/0x290 net/socket.c:579 sock_close+0x10/0x20 net/socket.c:1140 __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 get_signal+0x1352/0x1970 kernel/signal.c:2400 do_signal+0x87/0x1870 arch/x86/kernel/signal.c:799 exit_to_usermode_loop+0x159/0x1e0 arch/x86/entry/common.c:163 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 The buggy address belongs to the object at ffff8881e28f6a80 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 160 bytes inside of 2048-byte region [ffff8881e28f6a80, ffff8881e28f7280) The buggy address belongs to the page: page:ffffea00078a3d80 count:1 mapcount:0 mapping:ffff8881f6400c40 index:0x0 compound_mapcount: 0 flags: 0x17ffe0000008100(slab|head) raw: 017ffe0000008100 ffffea000774b808 ffffea0007713788 ffff8881f6400c40 raw: 0000000000000000 ffff8881e28f6200 0000000100000003 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881e28f6a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881e28f6a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881e28f6b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881e28f6b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e28f6c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================