bisecting fixing commit since dda0e2920330128e0dbdeb11c8f25031aa40b11c building syzkaller on a34e2c332411388ed2b3f6f1a3acdc062feceb79 testing commit dda0e2920330128e0dbdeb11c8f25031aa40b11c with gcc (GCC) 8.1.0 kernel signature: 140dff900608a7be879f0da5f9763ea3dde1be1caee6950a7b92928dc4c95149 run #0: crashed: KASAN: slab-out-of-bounds Write in tls_push_record run #1: crashed: KASAN: use-after-free Write in tls_push_record run #2: crashed: KASAN: use-after-free Write in tls_push_record run #3: crashed: KASAN: use-after-free Write in tls_push_record run #4: crashed: KASAN: use-after-free Write in tls_push_record run #5: crashed: KASAN: use-after-free Write in tls_push_record run #6: crashed: KASAN: use-after-free Write in tls_push_record run #7: crashed: KASAN: use-after-free Write in tls_push_record run #8: crashed: KASAN: use-after-free Write in tls_push_record run #9: crashed: KASAN: use-after-free Write in tls_push_record testing current HEAD fdc072324f3c66190a20f57490b4842a391d8233 testing commit fdc072324f3c66190a20f57490b4842a391d8233 with gcc (GCC) 8.1.0 kernel signature: f85c28c484dbeda26f5e3bfb319ee2bd78d89011e9481e784a0a48165cbfc5e7 run #0: crashed: KASAN: use-after-free Write in tls_push_record run #1: crashed: KASAN: use-after-free Write in tls_push_record run #2: crashed: KASAN: use-after-free Write in tls_push_record run #3: crashed: KASAN: use-after-free Write in tls_push_record run #4: crashed: KASAN: use-after-free Write in tls_push_record run #5: crashed: KASAN: use-after-free Write in tls_push_record run #6: crashed: KASAN: use-after-free Write in tls_push_record run #7: crashed: KASAN: use-after-free Write in tls_push_record run #8: crashed: KASAN: use-after-free Write in tls_push_record run #9: crashed: KASAN: out-of-bounds Write in tls_push_record revisions tested: 2, total time: 26m24.165136779s (build: 19m7.661341752s, test: 6m10.14030423s) the crash still happens on HEAD commit msg: Linux 4.19.120 crash: KASAN: out-of-bounds Write in tls_push_record FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 ================================================================== FAULT_INJECTION: forcing a failure. name failslab, interval 1, probability 0, space 0, times 0 BUG: KASAN: out-of-bounds in tls_fill_prepend include/net/tls.h:373 [inline] BUG: KASAN: out-of-bounds in tls_push_record+0x127a/0x1720 net/tls/tls_sw.c:220 Write of size 1 at addr ffff888089970000 by task syz-executor.1/7934 CPU: 0 PID: 7934 Comm: syz-executor.1 Not tainted 4.19.120-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_store1_noabort+0x17/0x20 mm/kasan/report.c:435 tls_fill_prepend include/net/tls.h:373 [inline] tls_push_record+0x127a/0x1720 net/tls/tls_sw.c:220 tls_sw_push_pending_record+0xe/0x10 net/tls/tls_sw.c:257 tls_handle_open_record net/tls/tls_main.c:156 [inline] tls_sk_proto_close+0x683/0x990 net/tls/tls_main.c:271 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 RIP: 0033:0x45c849 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:00007f2e6128ec78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: 0000000000004000 RBX: 00007f2e6128f6d4 RCX: 000000000045c849 RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000076bf00 R08: 0000000000000000 R09: 00000000000000d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 0000000000000a07 R14: 00000000004ccbd2 R15: 0000000000000002 The buggy address belongs to the page: CPU: 1 PID: 7947 Comm: syz-executor.4 Not tainted 4.19.120-syzkaller #0 page:ffffea0002265c00 count:2 mapcount:0 mapping:0000000000000000 index:0x0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 compound_mapcount: 0 Call Trace: flags: 0xfffe0000008000(head) __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x123/0x177 lib/dump_stack.c:118 raw: 00fffe0000008000 dead000000000100 dead000000000200 0000000000000000 raw: 0000000000000000 0000000000000000 00000002ffffffff 0000000000000000 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold.4+0x5/0x13 lib/fault-inject.c:149 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88808996ff00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88808996ff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888089970000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 __should_failslab+0xba/0xf0 mm/failslab.c:32 ^ should_failslab+0x9/0x14 mm/slab_common.c:1558 ffff888089970080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x2dd/0x770 mm/slab.c:3736 ffff888089970100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== kmalloc include/linux/slab.h:520 [inline] aead_request_alloc include/crypto/aead.h:425 [inline] tls_push_record+0xf3/0x1720 net/tls/tls_sw.c:209 tls_sw_sendmsg+0xb42/0x1020 net/tls/tls_sw.c:467 inet_sendmsg+0x108/0x440 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 __sys_sendto+0x1f2/0x2e0 net/socket.c:1787 __do_sys_sendto net/socket.c:1799 [inline] __se_sys_sendto net/socket.c:1795 [inline] __x64_sys_sendto+0xdc/0x1a0 net/socket.c:1795 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45c849 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:00007f6a87160c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f6a871616d4 RCX: 000000000045c849 RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000076bfa0 R08: 0000000000000000 R09: 00000000000000d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 0000000000000a07 R14: 00000000004ccbd2 R15: 0000000000000002 CPU: 1 PID: 7958 Comm: syz-executor.5 Tainted: G B 4.19.120-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 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold.4+0x5/0x13 lib/fault-inject.c:149 __should_failslab+0xba/0xf0 mm/failslab.c:32 should_failslab+0x9/0x14 mm/slab_common.c:1558 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x2dd/0x770 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] aead_request_alloc include/crypto/aead.h:425 [inline] tls_push_record+0xf3/0x1720 net/tls/tls_sw.c:209 tls_sw_sendmsg+0xb42/0x1020 net/tls/tls_sw.c:467 inet_sendmsg+0x108/0x440 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 __sys_sendto+0x1f2/0x2e0 net/socket.c:1787 __do_sys_sendto net/socket.c:1799 [inline] __se_sys_sendto net/socket.c:1795 [inline] __x64_sys_sendto+0xdc/0x1a0 net/socket.c:1795 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45c849 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:00007f3434c04c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f3434c056d4 RCX: 000000000045c849 RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000076bfa0 R08: 0000000000000000 R09: 00000000000000d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 0000000000000a07 R14: 00000000004ccbd2 R15: 0000000000000002 CPU: 1 PID: 7957 Comm: syz-executor.0 Tainted: G B 4.19.120-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 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold.4+0x5/0x13 lib/fault-inject.c:149 __should_failslab+0xba/0xf0 mm/failslab.c:32 should_failslab+0x9/0x14 mm/slab_common.c:1558 slab_pre_alloc_hook mm/slab.h:424 [inline] slab_alloc mm/slab.c:3383 [inline] __do_kmalloc mm/slab.c:3725 [inline] __kmalloc+0x2dd/0x770 mm/slab.c:3736 kmalloc include/linux/slab.h:520 [inline] aead_request_alloc include/crypto/aead.h:425 [inline] tls_push_record+0xf3/0x1720 net/tls/tls_sw.c:209 tls_sw_sendmsg+0xb42/0x1020 net/tls/tls_sw.c:467 inet_sendmsg+0x108/0x440 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 __sys_sendto+0x1f2/0x2e0 net/socket.c:1787 __do_sys_sendto net/socket.c:1799 [inline] __se_sys_sendto net/socket.c:1795 [inline] __x64_sys_sendto+0xdc/0x1a0 net/socket.c:1795 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45c849 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:00007f60b21a5c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f60b21a66d4 RCX: 000000000045c849 RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000076bfa0 R08: 0000000000000000 R09: 00000000000000d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 0000000000000a07 R14: 00000000004ccbd2 R15: 0000000000000002 FAULT_INJECTION: forcing a failure. name fail_page_alloc, interval 1, probability 0, space 0, times 0 CPU: 1 PID: 7970 Comm: syz-executor.2 Tainted: G B 4.19.120-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 fail_dump lib/fault-inject.c:51 [inline] should_fail.cold.4+0x5/0x13 lib/fault-inject.c:149 should_fail_alloc_page mm/page_alloc.c:3086 [inline] prepare_alloc_pages mm/page_alloc.c:4344 [inline] __alloc_pages_nodemask+0x1d5/0x710 mm/page_alloc.c:4391 alloc_pages_current+0xd6/0x1b0 mm/mempolicy.c:2197 alloc_pages include/linux/gfp.h:532 [inline] skb_page_frag_refill+0x1dd/0x490 net/core/sock.c:2218 sk_page_frag_refill+0x46/0x1b0 net/core/sock.c:2238 tcp_sendmsg_locked+0xc58/0x35b0 net/ipv4/tcp.c:1337 tcp_sendmsg+0x27/0x40 net/ipv4/tcp.c:1452 inet_sendmsg+0x108/0x440 net/ipv4/af_inet.c:798 sock_sendmsg_nosec net/socket.c:622 [inline] sock_sendmsg+0xb5/0xf0 net/socket.c:632 __sys_sendto+0x1f2/0x2e0 net/socket.c:1787 __do_sys_sendto net/socket.c:1799 [inline] __se_sys_sendto net/socket.c:1795 [inline] __x64_sys_sendto+0xdc/0x1a0 net/socket.c:1795 do_syscall_64+0xd0/0x4e0 arch/x86/entry/common.c:293 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x45c849 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:00007f36c0d6fc78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f36c0d706d4 RCX: 000000000045c849 RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000076c0e0 R08: 0000000000000000 R09: 00000000000000d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 0000000000000a07 R14: 00000000004ccbd2 R15: 0000000000000002 page:ffffea0002353800 count:0 mapcount:-128 mapping:0000000000000000 index:0x0 flags: 0xfffe0000000000() raw: 00fffe0000000000 ffffea0002263808 ffff88812fffb8f8 0000000000000000 raw: 0000000000000000 0000000000000003 00000000ffffff7f 0000000000000000 page dumped because: VM_BUG_ON_PAGE(page_ref_count(page) == 0) ------------[ cut here ]------------ kernel BUG at include/linux/mm.h:519! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 7947 Comm: syz-executor.4 Tainted: G B 4.19.120-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 RIP: 0010:put_page_testzero include/linux/mm.h:519 [inline] RIP: 0010:put_page include/linux/mm.h:950 [inline] RIP: 0010:tls_sk_proto_close+0x697/0x990 net/tls/tls_main.c:277 Code: 3c 02 00 0f 85 9c 02 00 00 31 f6 4c 89 ff 41 ff 94 24 e8 00 00 00 e9 99 fb ff ff 48 c7 c6 e0 a8 c8 87 4c 89 f7 e8 49 c3 a3 fb <0f> 0b 49 8d bd a0 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa RSP: 0018:ffff888089fe7a10 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffff888089b34620 RCX: 0000000000000000 RDX: 1ffffd400046a707 RSI: 0000000000000000 RDI: ffffea0002353838 RBP: ffff888089fe7ad0 R08: ffffed1015d63ee3 R09: ffffed1015d63ee2 R10: ffffed1015d63ee2 R11: ffff8880aeb1f717 R12: dffffc0000000000 R13: ffff8880a0202040 R14: ffffea0002353800 R15: ffff8880a92b01c0 FS: 00007f6a87161700(0000) GS:ffff8880aeb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fda5403e078 CR3: 000000008a510000 CR4: 00000000001406e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: 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 RIP: 0033:0x45c849 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:00007f6a87160c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: 0000000000004000 RBX: 00007f6a871616d4 RCX: 000000000045c849 RDX: 00000000e0ffffff RSI: 00000000200005c0 RDI: 0000000000000003 RBP: 000000000076bfa0 R08: 0000000000000000 R09: 00000000000000d8 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 R13: 0000000000000a07 R14: 00000000004ccbd2 R15: 0000000000000002 Modules linked in: ---[ end trace 8c0b223d1556867c ]--- RIP: 0010:put_page_testzero include/linux/mm.h:519 [inline] RIP: 0010:put_page include/linux/mm.h:950 [inline] RIP: 0010:tls_sk_proto_close+0x697/0x990 net/tls/tls_main.c:277 Code: 3c 02 00 0f 85 9c 02 00 00 31 f6 4c 89 ff 41 ff 94 24 e8 00 00 00 e9 99 fb ff ff 48 c7 c6 e0 a8 c8 87 4c 89 f7 e8 49 c3 a3 fb <0f> 0b 49 8d bd a0 00 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa RSP: 0018:ffff888089fe7a10 EFLAGS: 00010246 RAX: dffffc0000000000 RBX: ffff888089b34620 RCX: 0000000000000000 RDX: 1ffffd400046a707 RSI: 0000000000000000 RDI: ffffea0002353838 RBP: ffff888089fe7ad0 R08: ffffed1015d63ee3 R09: ffffed1015d63ee2 R10: ffffed1015d63ee2 R11: ffff8880aeb1f717 R12: dffffc0000000000 R13: ffff8880a0202040 R14: ffffea0002353800 R15: ffff8880a92b01c0 FS: 00007f6a87161700(0000) GS:ffff8880aeb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fda5403e078 CR3: 000000008a510000 CR4: 00000000001406e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400