bisecting fixing commit since b499cf4b3a901e87e1f933df04abf69b54de4457 building syzkaller on 35f5e45ed3cc032d9f969f3a8700e29607c1364f testing commit b499cf4b3a901e87e1f933df04abf69b54de4457 with gcc (GCC) 8.1.0 kernel signature: 23ce8d088d7486f31de9be7652eedbbcccadabd4b4a243b21a89197b9a4485d4 all runs: crashed: KASAN: use-after-free Read in __lock_sock testing current HEAD 033c4ea49a4ba7a2b13aabf3ec755557924a9cda testing commit 033c4ea49a4ba7a2b13aabf3ec755557924a9cda with gcc (GCC) 8.1.0 kernel signature: edf4c3abe83f11d6224ee13a6c7843d75167b4079999d2036b6000766c006880 run #0: crashed: KASAN: use-after-free Read in __lock_sock run #1: crashed: KASAN: use-after-free Read in sctp_sock_dump run #2: crashed: KASAN: use-after-free Read in __lock_sock run #3: crashed: KASAN: use-after-free Read in __lock_sock run #4: crashed: KASAN: use-after-free Read in __lock_sock run #5: crashed: KASAN: use-after-free Read in __lock_sock run #6: crashed: KASAN: use-after-free Read in sctp_sock_dump run #7: crashed: KASAN: use-after-free Read in __lock_sock run #8: crashed: KASAN: use-after-free Read in __lock_sock run #9: crashed: KASAN: use-after-free Read in sctp_sock_dump revisions tested: 2, total time: 26m46.179545335s (build: 18m42.87698987s, test: 6m55.78022904s) the crash still happens on HEAD commit msg: Linux 4.19.122 crash: KASAN: use-after-free Read in sctp_sock_dump ================================================================== BUG: KASAN: use-after-free in sctp_sock_dump+0xbf4/0xc70 net/sctp/diag.c:322 Read of size 8 at addr ffff88809f6fc160 by task syz-executor.1/19157 CPU: 1 PID: 19157 Comm: syz-executor.1 Not tainted 4.19.122-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+0x123/0x177 lib/dump_stack.c:118 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256 kasan_report_error mm/kasan/report.c:354 [inline] kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433 sctp_sock_dump+0xbf4/0xc70 net/sctp/diag.c:322 sctp_for_each_transport+0x21e/0x280 net/sctp/socket.c:5077 sctp_diag_dump+0x271/0x510 net/sctp/diag.c:524 __inet_diag_dump+0x7f/0x110 net/ipv4/inet_diag.c:1056 inet_diag_dump+0x74/0xf0 net/ipv4/inet_diag.c:1072 netlink_dump+0x3aa/0xb80 net/netlink/af_netlink.c:2234 __netlink_dump_start+0x496/0x6c0 net/netlink/af_netlink.c:2330 netlink_dump_start include/linux/netlink.h:213 [inline] inet_diag_handler_cmd+0x1d5/0x2c0 net/ipv4/inet_diag.c:1177 __sock_diag_cmd net/core/sock_diag.c:232 [inline] sock_diag_rcv_msg+0x289/0x370 net/core/sock_diag.c:263 netlink_rcv_skb+0x142/0x390 net/netlink/af_netlink.c:2455 sock_diag_rcv+0x25/0x40 net/core/sock_diag.c:274 netlink_unicast_kernel net/netlink/af_netlink.c:1318 [inline] netlink_unicast+0x443/0x650 net/netlink/af_netlink.c:1344 netlink_sendmsg+0x765/0xc40 net/netlink/af_netlink.c:1909 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 sock_write_iter+0x215/0x420 net/socket.c:901 call_write_iter include/linux/fs.h:1821 [inline] do_iter_readv_writev+0x4ae/0x960 fs/read_write.c:681 do_iter_write+0x12a/0x510 fs/read_write.c:960 vfs_writev+0x16f/0x2d0 fs/read_write.c:1005 do_writev+0x110/0x330 fs/read_write.c:1040 __do_sys_writev fs/read_write.c:1113 [inline] __se_sys_writev fs/read_write.c:1110 [inline] __x64_sys_writev+0x70/0xb0 fs/read_write.c:1110 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45b399 Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 RSP: 002b:00007fcc56336c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007fcc563376d4 RCX: 000000000045b399 RDX: 0000000000000001 RSI: 0000000020000000 RDI: 000000000000000b RBP: 000000000075bfc8 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff R13: 0000000000000cdd R14: 00000000004c9cac R15: 000000000075bfd4 Allocated by task 19158: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553 kmem_cache_alloc_trace+0x152/0x740 mm/slab.c:3625 kmalloc include/linux/slab.h:515 [inline] kzalloc include/linux/slab.h:709 [inline] sctp_endpoint_new+0x65/0xc70 net/sctp/endpointola.c:192 sctp_init_sock+0xb6c/0x1230 net/sctp/socket.c:4762 inet6_create+0x872/0xdd0 net/ipv6/af_inet6.c:255 __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 19146: save_stack+0x43/0xd0 mm/kasan/kasan.c:448 set_track mm/kasan/kasan.c:460 [inline] __kasan_slab_free+0x102/0x150 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 sctp_endpoint_destroy net/sctp/endpointola.c:282 [inline] sctp_endpoint_put+0x1dd/0x260 net/sctp/endpointola.c:298 sctp_endpoint_free+0x6c/0x80 net/sctp/endpointola.c:241 sctp_destroy_sock+0x84/0x390 net/sctp/socket.c:4815 sctp_v6_destroy_sock+0xd/0x20 net/sctp/socket.c:8974 sk_common_release+0x5e/0x2c0 net/core/sock.c:3070 sctp_close+0x3de/0x750 net/sctp/socket.c:1582 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: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+0x139a/0x1a00 kernel/signal.c:2399 do_signal+0x87/0x1960 arch/x86/kernel/signal.c:821 exit_to_usermode_loop+0x114/0x200 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 ffff88809f6fc0c0 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 160 bytes inside of 512-byte region [ffff88809f6fc0c0, ffff88809f6fc2c0) The buggy address belongs to the page: page:ffffea00027dbf00 count:1 mapcount:0 mapping:ffff88812c29c940 index:0x0 flags: 0xfffe0000000100(slab) raw: 00fffe0000000100 ffffea0002808348 ffffea0002a5d608 ffff88812c29c940 raw: 0000000000000000 ffff88809f6fc0c0 0000000100000006 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88809f6fc000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88809f6fc080: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb >ffff88809f6fc100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88809f6fc180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88809f6fc200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================