bisecting fixing commit since 14b58326976de6ef3998eefec1dd7f8b38b97a75 building syzkaller on 28ac5c9e93a44c3eb145195ffb55591be58ef510 testing commit 14b58326976de6ef3998eefec1dd7f8b38b97a75 with gcc (GCC) 8.4.1 20210217 kernel signature: 4e4acd98a37364afbc774b006020fab949ad9a830ccea996e59c03f2f2db7d48 run #0: crashed: BUG: corrupted list in l2cap_chan_put run #1: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #2: crashed: BUG: corrupted list in l2cap_chan_put run #3: crashed: KASAN: use-after-free Read in l2cap_chan_put run #4: crashed: BUG: corrupted list in l2cap_chan_put run #5: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #6: crashed: BUG: corrupted list in l2cap_chan_put run #7: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #8: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #9: crashed: BUG: corrupted list in l2cap_chan_put run #10: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #11: crashed: BUG: corrupted list in l2cap_chan_put run #12: crashed: KASAN: use-after-free Write in ex_handler_refcount run #13: crashed: KASAN: use-after-free Write in ex_handler_refcount run #14: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #15: crashed: BUG: corrupted list in l2cap_chan_put run #16: crashed: BUG: corrupted list in l2cap_chan_put run #17: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #18: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #19: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown testing current HEAD cb83ddcd5332fcc3efd52ba994976efc4dd6061e testing commit cb83ddcd5332fcc3efd52ba994976efc4dd6061e with gcc (GCC) 8.4.1 20210217 kernel signature: 52742fabc4e76ca514d62b8dbdb3d4680725e307ba5bc54a938bd9ee4c01f649 run #0: crashed: BUG: corrupted list in l2cap_chan_put run #1: crashed: BUG: corrupted list in l2cap_chan_put run #2: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #3: crashed: BUG: corrupted list in l2cap_chan_put run #4: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #5: crashed: BUG: corrupted list in l2cap_chan_put run #6: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown run #7: crashed: BUG: corrupted list in l2cap_chan_put run #8: crashed: BUG: corrupted list in l2cap_chan_put run #9: crashed: KASAN: use-after-free Read in l2cap_sock_shutdown revisions tested: 2, total time: 34m49.123425473s (build: 15m37.62621726s, test: 18m42.828697542s) the crash still happens on HEAD commit msg: Linux 4.14.226 crash: KASAN: use-after-free Read in l2cap_sock_shutdown Bluetooth: hci2 command 0x0419 tx timeout Bluetooth: hci3 command 0x0419 tx timeout Bluetooth: hci4 command 0x0419 tx timeout Bluetooth: hci5 command 0x0419 tx timeout ================================================================== BUG: KASAN: use-after-free in l2cap_sock_shutdown+0x954/0xbb0 net/bluetooth/l2cap_sock.c:1132 Read of size 1 at addr ffff8881c961a3be by task syz-executor303/460 CPU: 1 PID: 460 Comm: syz-executor303 Not tainted 4.14.226-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:17 [inline] dump_stack+0x14b/0x1e7 lib/dump_stack.c:58 print_address_description.cold.6+0x9/0x1ca mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 [inline] kasan_report mm/kasan/report.c:409 [inline] kasan_report.cold.7+0x11a/0x2d3 mm/kasan/report.c:393 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report.c:427 l2cap_sock_shutdown+0x954/0xbb0 net/bluetooth/l2cap_sock.c:1132 l2cap_sock_release+0x60/0x230 net/bluetooth/l2cap_sock.c:1203 __sock_release+0xc2/0x2a0 net/socket.c:602 sock_close+0x10/0x20 net/socket.c:1139 __fput+0x232/0x740 fs/file_table.c:210 ____fput+0x9/0x10 fs/file_table.c:244 task_work_run+0xe5/0x170 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x14a/0x190 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x416/0x5b0 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x406fcb RSP: 002b:00007ffc7f4e3ee0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000406fcb RDX: ffffffffffffffb8 RSI: 00000000400443c8 RDI: 0000000000000004 RBP: 0000000000000000 R08: 0000000000000000 R09: 0404040400000015 R10: 0000000000000000 R11: 0000000000000293 R12: 00000000000696b9 R13: 00007ffc7f4e3f60 R14: 00007ffc7f4e3f50 R15: 00007ffc7f4e3f10 Allocated by task 460: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_kmalloc.part.1+0x62/0xf0 mm/kasan/kasan.c:551 kasan_kmalloc+0xaf/0xc0 mm/kasan/kasan.c:536 kmem_cache_alloc_trace+0x152/0x3f0 mm/slab.c:3618 kmalloc include/linux/slab.h:488 [inline] kzalloc include/linux/slab.h:661 [inline] l2cap_chan_create+0x41/0x380 net/bluetooth/l2cap_core.c:444 l2cap_sock_alloc.constprop.4+0x150/0x1e0 net/bluetooth/l2cap_sock.c:1633 l2cap_sock_create+0xb5/0x180 net/bluetooth/l2cap_sock.c:1664 bt_sock_create+0x121/0x260 net/bluetooth/af_bluetooth.c:130 __sock_create+0x262/0x540 net/socket.c:1275 sock_create net/socket.c:1315 [inline] SYSC_socket net/socket.c:1345 [inline] SyS_socket+0xd5/0x1e0 net/socket.c:1325 do_syscall_64+0x1c7/0x5b0 arch/x86/entry/common.c:292 entry_SYSCALL_64_after_hwframe+0x46/0xbb Freed by task 1202: save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59 save_stack mm/kasan/kasan.c:447 [inline] set_track mm/kasan/kasan.c:459 [inline] kasan_slab_free+0xab/0x190 mm/kasan/kasan.c:524 __cache_free mm/slab.c:3496 [inline] kfree+0xcc/0x270 mm/slab.c:3815 l2cap_chan_destroy net/bluetooth/l2cap_core.c:482 [inline] kref_put include/linux/kref.h:70 [inline] l2cap_chan_put+0x141/0x1a0 net/bluetooth/l2cap_core.c:496 l2cap_conless_channel net/bluetooth/l2cap_core.c:6982 [inline] l2cap_recv_frame+0xeca/0x9e10 net/bluetooth/l2cap_core.c:7029 l2cap_recv_acldata+0x756/0x8a0 net/bluetooth/l2cap_core.c:7594 hci_acldata_packet net/bluetooth/hci_core.c:4068 [inline] hci_rx_work+0x5c9/0x8e0 net/bluetooth/hci_core.c:4251 process_one_work+0x74f/0x1620 kernel/workqueue.c:2116 worker_thread+0xcc/0xee0 kernel/workqueue.c:2250 kthread+0x338/0x400 kernel/kthread.c:232 ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:404 The buggy address belongs to the object at ffff8881c961a380 which belongs to the cache kmalloc-2048 of size 2048 The buggy address is located 62 bytes inside of 2048-byte region [ffff8881c961a380, ffff8881c961ab80) The buggy address belongs to the page: page:ffffea0007258680 count:1 mapcount:0 mapping:ffff8881c961a380 index:0x0 compound_mapcount: 0 flags: 0x17ffe0000008100(slab|head) raw: 017ffe0000008100 ffff8881c961a380 0000000000000000 0000000100000003 raw: ffffea00077663a0 ffffea0007960aa0 ffff8881f6000c40 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff8881c961a280: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881c961a300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881c961a380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881c961a400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881c961a480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== list_del corruption, ffff8881c961a7e8->next is LIST_POISON1 (dead000000000100) ------------[ cut here ]------------ kernel BUG at lib/list_debug.c:47! invalid opcode: 0000 [#1] PREEMPT SMP KASAN Modules linked in: CPU: 1 PID: 460 Comm: syz-executor303 Tainted: G B 4.14.226-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 task: ffff8881f483a100 task.stack: ffff8881dd3a8000 RIP: 0010:__list_del_entry_valid.cold.1+0x26/0x4a lib/list_debug.c:45 RSP: 0000:ffff8881dd3afcf8 EFLAGS: 00010282 RAX: 000000000000004e RBX: ffff8881c961a7e8 RCX: 0000000000000000 RDX: 000000000000004e RSI: ffffffff86cbec60 RDI: ffffed103ba75f96 RBP: ffff8881dd3afd10 R08: 0000000000000000 R09: 0000000000000000 R10: fffffbfff13446c7 R11: dffffc0000000000 R12: dead000000000200 R13: dead000000000100 R14: ffff8881c961a808 R15: ffff8881c961af60 FS: 00000000015c9300(0000) GS:ffff8881f6700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000444b1b CR3: 00000001dd89a004 CR4: 00000000001606e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: __list_del_entry include/linux/list.h:117 [inline] list_del include/linux/list.h:125 [inline] l2cap_chan_destroy net/bluetooth/l2cap_core.c:479 [inline] kref_put include/linux/kref.h:70 [inline] l2cap_chan_put+0x49/0x1a0 net/bluetooth/l2cap_core.c:496 l2cap_sock_release+0x1b4/0x230 net/bluetooth/l2cap_sock.c:1213 __sock_release+0xc2/0x2a0 net/socket.c:602 sock_close+0x10/0x20 net/socket.c:1139 __fput+0x232/0x740 fs/file_table.c:210 ____fput+0x9/0x10 fs/file_table.c:244 task_work_run+0xe5/0x170 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:191 [inline] exit_to_usermode_loop+0x14a/0x190 arch/x86/entry/common.c:164 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline] syscall_return_slowpath arch/x86/entry/common.c:270 [inline] do_syscall_64+0x416/0x5b0 arch/x86/entry/common.c:297 entry_SYSCALL_64_after_hwframe+0x46/0xbb RIP: 0033:0x406fcb RSP: 002b:00007ffc7f4e3ee0 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000005 RCX: 0000000000406fcb RDX: ffffffffffffffb8 RSI: 00000000400443c8 RDI: 0000000000000004 RBP: 0000000000000000 R08: 0000000000000000 R09: 0404040400000015 R10: 0000000000000000 R11: 0000000000000293 R12: 00000000000696b9 R13: 00007ffc7f4e3f60 R14: 00007ffc7f4e3f50 R15: 00007ffc7f4e3f10 Code: 86 f9 ff 0f 0b 4c 89 e2 48 89 de 48 c7 c7 a0 0e 04 87 e8 d4 86 f9 ff 0f 0b 4c 89 ea 48 89 de 48 c7 c7 40 0e 04 87 e8 c0 86 f9 ff <0f> 0b 48 89 de 48 c7 c7 60 0f 04 87 e8 af 86 f9 ff 0f 0b 48 89 RIP: __list_del_entry_valid.cold.1+0x26/0x4a lib/list_debug.c:45 RSP: ffff8881dd3afcf8 ---[ end trace adf6a0224896cac4 ]---