bisecting fixing commit since c70672d8d316ebd46ea447effadfe57ab7a30a50 building syzkaller on abf9ba4fc75d9b29af15625d44dcfc1360fad3b7 testing commit c70672d8d316ebd46ea447effadfe57ab7a30a50 with gcc (GCC) 8.4.1 20210217 kernel signature: 0649c3677b3b0c6035b8af7a3a002246418f0a2171562d553bdbb05af66f6618 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: KASAN: null-ptr-deref Write in l2cap_chan_put run #4: crashed: WARNING: locking bug in l2cap_sock_teardown_cb run #5: crashed: KASAN: use-after-free Read in lock_sock_nested run #6: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #7: crashed: KASAN: use-after-free Read in lock_sock_nested run #8: crashed: INFO: trying to register non-static key in l2cap_sock_teardown_cb run #9: crashed: KASAN: null-ptr-deref Write 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: KASAN: null-ptr-deref Write in l2cap_chan_put run #13: crashed: KASAN: use-after-free Read in lock_sock_nested run #14: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #15: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #16: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #17: crashed: KASAN: slab-out-of-bounds Read in lock_sock_nested run #18: crashed: KASAN: use-after-free Read in lock_sock_nested run #19: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put testing current HEAD 2734d6c1b1a089fb593ef6a23d4b70903526fe0c testing commit 2734d6c1b1a089fb593ef6a23d4b70903526fe0c with gcc (GCC) 10.2.1 20210217 kernel signature: bd86cb315e4505a524b74970e7a65a70d8751fcb58b65e518e50c864a57521a9 run #0: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #1: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #2: crashed: KASAN: use-after-free Read in lock_sock_nested run #3: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #4: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #5: crashed: KASAN: use-after-free Read in lock_sock_nested run #6: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #7: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put run #8: crashed: KASAN: use-after-free Read in lock_sock_nested run #9: crashed: KASAN: null-ptr-deref Write in l2cap_chan_put revisions tested: 2, total time: 21m44.239791193s (build: 12m24.600971438s, test: 8m23.626538383s) the crash still happens on HEAD commit msg: Linux 5.14-rc2 crash: KASAN: null-ptr-deref Write in l2cap_chan_put ================================================================== BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: null-ptr-deref in atomic_fetch_sub_release include/asm-generic/atomic-instrumented.h:167 [inline] BUG: KASAN: null-ptr-deref in __refcount_sub_and_test include/linux/refcount.h:272 [inline] BUG: KASAN: null-ptr-deref in __refcount_dec_and_test include/linux/refcount.h:315 [inline] BUG: KASAN: null-ptr-deref in refcount_dec_and_test include/linux/refcount.h:333 [inline] BUG: KASAN: null-ptr-deref in kref_put include/linux/kref.h:64 [inline] BUG: KASAN: null-ptr-deref in l2cap_chan_put+0x1c/0x1c0 net/bluetooth/l2cap_core.c:504 Write of size 4 at addr 0000000000000018 by task kworker/1:8/7413 CPU: 1 PID: 7413 Comm: kworker/1:8 Not tainted 5.14.0-rc2-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:88 [inline] dump_stack_lvl+0xbd/0xe2 lib/dump_stack.c:105 __kasan_report mm/kasan/report.c:423 [inline] kasan_report.cold+0x66/0xdf mm/kasan/report.c:436 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_fetch_sub_release include/asm-generic/atomic-instrumented.h:167 [inline] __refcount_sub_and_test include/linux/refcount.h:272 [inline] __refcount_dec_and_test include/linux/refcount.h:315 [inline] refcount_dec_and_test include/linux/refcount.h:333 [inline] kref_put include/linux/kref.h:64 [inline] l2cap_chan_put+0x1c/0x1c0 net/bluetooth/l2cap_core.c:504 l2cap_sock_kill+0x95/0x110 net/bluetooth/l2cap_sock.c:1225 l2cap_chan_timeout+0x171/0x3a0 net/bluetooth/l2cap_core.c:438 process_one_work+0x84c/0x13d0 kernel/workqueue.c:2276 worker_thread+0x598/0x1040 kernel/workqueue.c:2422 kthread+0x38b/0x460 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 ================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000018 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 11a785067 P4D 11a785067 PUD 100eaa067 PMD 0 Oops: 0002 [#1] PREEMPT SMP KASAN CPU: 1 PID: 7413 Comm: kworker/1:8 Tainted: G B 5.14.0-rc2-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Workqueue: events l2cap_chan_timeout RIP: 0010:arch_atomic_fetch_sub arch/x86/include/asm/atomic.h:190 [inline] RIP: 0010:atomic_fetch_sub_release include/asm-generic/atomic-instrumented.h:168 [inline] RIP: 0010:__refcount_sub_and_test include/linux/refcount.h:272 [inline] RIP: 0010:__refcount_dec_and_test include/linux/refcount.h:315 [inline] RIP: 0010:refcount_dec_and_test include/linux/refcount.h:333 [inline] RIP: 0010:kref_put include/linux/kref.h:64 [inline] RIP: 0010:l2cap_chan_put+0x21/0x1c0 net/bluetooth/l2cap_core.c:504 Code: 35 56 03 fb eb ad 0f 1f 00 41 56 be 04 00 00 00 41 55 41 54 4c 8d 67 18 55 48 89 fd 4c 89 e7 53 e8 94 59 03 fb b8 ff ff ff ff 0f c1 45 18 83 f8 01 74 11 85 c0 0f 8e 2b 01 00 00 5b 5d 41 5c RSP: 0018:ffffc90004e67ca8 EFLAGS: 00010246 RAX: 00000000ffffffff RBX: ffff88811a78e110 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000004 RDI: 0000000000000001 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: fffffbfff12f2bec R11: 6e696c6261736944 R12: 0000000000000018 R13: ffff88811a78e4b8 R14: ffffffff88ab1960 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff8881f6500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000018 CR3: 0000000101b51000 CR4: 0000000000350ee0 Call Trace: l2cap_sock_kill+0x95/0x110 net/bluetooth/l2cap_sock.c:1225 l2cap_chan_timeout+0x171/0x3a0 net/bluetooth/l2cap_core.c:438 process_one_work+0x84c/0x13d0 kernel/workqueue.c:2276 worker_thread+0x598/0x1040 kernel/workqueue.c:2422 kthread+0x38b/0x460 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Modules linked in: CR2: 0000000000000018 ---[ end trace 58bdca0e201abd44 ]--- RIP: 0010:arch_atomic_fetch_sub arch/x86/include/asm/atomic.h:190 [inline] RIP: 0010:atomic_fetch_sub_release include/asm-generic/atomic-instrumented.h:168 [inline] RIP: 0010:__refcount_sub_and_test include/linux/refcount.h:272 [inline] RIP: 0010:__refcount_dec_and_test include/linux/refcount.h:315 [inline] RIP: 0010:refcount_dec_and_test include/linux/refcount.h:333 [inline] RIP: 0010:kref_put include/linux/kref.h:64 [inline] RIP: 0010:l2cap_chan_put+0x21/0x1c0 net/bluetooth/l2cap_core.c:504 Code: 35 56 03 fb eb ad 0f 1f 00 41 56 be 04 00 00 00 41 55 41 54 4c 8d 67 18 55 48 89 fd 4c 89 e7 53 e8 94 59 03 fb b8 ff ff ff ff 0f c1 45 18 83 f8 01 74 11 85 c0 0f 8e 2b 01 00 00 5b 5d 41 5c RSP: 0018:ffffc90004e67ca8 EFLAGS: 00010246 RAX: 00000000ffffffff RBX: ffff88811a78e110 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000004 RDI: 0000000000000001 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: fffffbfff12f2bec R11: 6e696c6261736944 R12: 0000000000000018 R13: ffff88811a78e4b8 R14: ffffffff88ab1960 R15: 0000000000000001 FS: 0000000000000000(0000) GS:ffff8881f6500000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000018 CR3: 0000000101b51000 CR4: 0000000000350ee0