bisecting fixing commit since 78e709522d2c012cb0daad2e668506637bffb7c2 building syzkaller on 5ae8508a2dd5f8e16a2b9830ae9a6f37d54ec8e7 testing commit 78e709522d2c012cb0daad2e668506637bffb7c2 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: a9ee8b045e5ead72fbe14b5ba3f27f4e7dade83d639c18306638c2a676910138 run #0: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #1: crashed: KASAN: use-after-free Read in skb_copy_bits run #2: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #3: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #4: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #5: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #6: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #7: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #8: crashed: KASAN: slab-out-of-bounds Write in null_skcipher_crypt run #9: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #10: crashed: KASAN: slab-out-of-bounds Write in null_skcipher_crypt run #11: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #12: crashed: KASAN: slab-out-of-bounds Write in null_skcipher_crypt run #13: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #14: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #15: crashed: KASAN: use-after-free Read in skb_copy_bits run #16: crashed: KASAN: use-after-free Read in skb_copy_bits run #17: crashed: KASAN: use-after-free Read in skb_copy_bits run #18: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #19: crashed: KASAN: use-after-free Write in null_skcipher_crypt testing current HEAD 2585cf9dfaaddf00b069673f27bb3f8530e2039c testing commit 2585cf9dfaaddf00b069673f27bb3f8530e2039c compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: f85ccbfdccf356c02ebd8c87ae7f87de16f93aedd14b44030a0ae5939542bea3 run #0: basic kernel testing failed: BUG: program execution failed: executor NUM: EOF run #1: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #2: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #3: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #4: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #5: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #6: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #7: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #8: crashed: KASAN: use-after-free Write in null_skcipher_crypt run #9: crashed: KASAN: use-after-free Write in null_skcipher_crypt revisions tested: 2, total time: 19m26.611718966s (build: 12m41.980612345s, test: 6m8.998495564s) the crash still happens on HEAD commit msg: Linux 5.16-rc5 crash: KASAN: use-after-free Write in null_skcipher_crypt ================================================================== BUG: KASAN: use-after-free in memcpy include/linux/fortify-string.h:225 [inline] BUG: KASAN: use-after-free in null_skcipher_crypt+0x8f/0xf0 crypto/crypto_null.c:85 Write of size 4096 at addr ffff8880183c0000 by task syz-executor.2/3997 CPU: 1 PID: 3997 Comm: syz-executor.2 Not tainted 5.16.0-rc5-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 memcpy+0x39/0x60 mm/kasan/shadow.c:66 memcpy include/linux/fortify-string.h:225 [inline] null_skcipher_crypt+0x8f/0xf0 crypto/crypto_null.c:85 crypto_authenc_encrypt+0x38b/0x530 crypto/authenc.c:222 esp6_output_tail+0x6de/0x1b60 net/ipv6/esp6.c:659 esp6_output+0x45d/0x910 net/ipv6/esp6.c:735 xfrm_output_one net/xfrm/xfrm_output.c:552 [inline] xfrm_output_resume+0x4ea/0x6110 net/xfrm/xfrm_output.c:587 NF_HOOK_COND include/linux/netfilter.h:296 [inline] xfrm6_output+0xe3/0x410 net/ipv6/xfrm6_output.c:92 ip6_send_skb+0x8f/0x2f0 net/ipv6/ip6_output.c:1912 rawv6_push_pending_frames net/ipv6/raw.c:613 [inline] rawv6_sendmsg+0x21d6/0x30c0 net/ipv6/raw.c:956 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:724 ____sys_sendmsg+0x5bf/0x7a0 net/socket.c:2409 ___sys_sendmsg+0xd3/0x150 net/socket.c:2463 __sys_sendmsg+0xb2/0x140 net/socket.c:2492 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4665f9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc1e897a188 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665f9 RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000004 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 0000000000a9fb1f R14: 00007fc1e897a300 R15: 0000000000022000 Allocated by task 3215: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:590 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x183/0x1cd0 security/tomoyo/audit.c:255 tomoyo_supervisor+0x2fc/0xc40 security/tomoyo/common.c:2097 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x252/0x380 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x27a/0x2c0 security/tomoyo/file.c:780 security_file_open+0x34/0x80 security/security.c:1635 do_dentry_open+0x30c/0x1040 fs/open.c:809 do_open fs/namei.c:3426 [inline] path_openat+0x9ea/0x2250 fs/namei.c:3559 do_filp_open+0x199/0x3d0 fs/namei.c:3586 do_sys_openat2+0x11e/0x400 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1239 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 3215: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kfree+0xf6/0x560 mm/slub.c:4561 tomoyo_init_log+0x11a3/0x1cd0 security/tomoyo/audit.c:294 tomoyo_supervisor+0x2fc/0xc40 security/tomoyo/common.c:2097 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x252/0x380 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x27a/0x2c0 security/tomoyo/file.c:780 security_file_open+0x34/0x80 security/security.c:1635 do_dentry_open+0x30c/0x1040 fs/open.c:809 do_open fs/namei.c:3426 [inline] path_openat+0x9ea/0x2250 fs/namei.c:3559 do_filp_open+0x199/0x3d0 fs/namei.c:3586 do_sys_openat2+0x11e/0x400 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1239 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff8880183c0000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 0 bytes inside of 4096-byte region [ffff8880183c0000, ffff8880183c1000) The buggy address belongs to the page: page:ffffea000060f000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x183c0 head:ffffea000060f000 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88800fc42140 raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3215, ts 52090953469, free_ts 52084370093 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa6f/0x2f10 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x91a/0xfd0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] kmem_cache_alloc_trace+0x289/0x2c0 mm/slub.c:3259 kmalloc include/linux/slab.h:590 [inline] tomoyo_print_header security/tomoyo/audit.c:156 [inline] tomoyo_init_log+0x183/0x1cd0 security/tomoyo/audit.c:255 tomoyo_supervisor+0x2fc/0xc40 security/tomoyo/common.c:2097 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x252/0x380 security/tomoyo/file.c:573 tomoyo_check_open_permission+0x27a/0x2c0 security/tomoyo/file.c:780 security_file_open+0x34/0x80 security/security.c:1635 do_dentry_open+0x30c/0x1040 fs/open.c:809 do_open fs/namei.c:3426 [inline] path_openat+0x9ea/0x2250 fs/namei.c:3559 do_filp_open+0x199/0x3d0 fs/namei.c:3586 do_sys_openat2+0x11e/0x400 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1239 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 __unfreeze_partials+0x343/0x360 mm/slub.c:2527 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:3234 [inline] kmem_cache_alloc_node+0x255/0x3f0 mm/slub.c:3270 __alloc_skb+0x151/0x270 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1126 [inline] netlink_alloc_large_skb net/netlink/af_netlink.c:1191 [inline] netlink_sendmsg+0x7f8/0xc10 net/netlink/af_netlink.c:1896 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:724 __sys_sendto+0x1a4/0x270 net/socket.c:2036 __do_sys_sendto net/socket.c:2048 [inline] __se_sys_sendto net/socket.c:2044 [inline] __x64_sys_sendto+0xd8/0x1b0 net/socket.c:2044 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff8880183bff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8880183bff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8880183c0000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880183c0080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880183c0100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================