bisecting fixing commit since 7fd2bf83d59a2d32e0d596c5d3e623b9a0e7e2d5 building syzkaller on 838e7e2cd9228583ca33c49a39aea4d863d3e36d testing commit 7fd2bf83d59a2d32e0d596c5d3e623b9a0e7e2d5 compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 1ea94d1a92e7d49dc3d6a449c0bbea04cb19022e1787c51b44fd2f33eba59b87 all runs: crashed: KASAN: use-after-free Read in consume_skb testing current HEAD 705d84a366cfccda1e7aec1113a5399cd2ffee7d testing commit 705d84a366cfccda1e7aec1113a5399cd2ffee7d compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: fd63b7357a19fd7e52009735f57800ad34c738780e7794cffcb6d863b5c89241 all runs: crashed: KASAN: use-after-free Read in consume_skb revisions tested: 2, total time: 19m51.756405802s (build: 12m52.100637863s, test: 6m12.21545905s) the crash still happens on HEAD commit msg: Merge tag 'for-5.17-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux crash: KASAN: use-after-free Read in consume_skb ================================================================== BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline] BUG: KASAN: use-after-free in atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline] BUG: KASAN: use-after-free in refcount_read include/linux/refcount.h:147 [inline] BUG: KASAN: use-after-free in skb_unref include/linux/skbuff.h:1098 [inline] BUG: KASAN: use-after-free in consume_skb+0x23/0xf0 net/core/skbuff.c:910 Read of size 4 at addr ffff8880717c0494 by task syz-executor.4/4312 CPU: 0 PID: 4312 Comm: syz-executor.4 Not tainted 5.17.0-rc4-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/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 instrument_atomic_read include/linux/instrumented.h:71 [inline] atomic_read include/linux/atomic/atomic-instrumented.h:27 [inline] refcount_read include/linux/refcount.h:147 [inline] skb_unref include/linux/skbuff.h:1098 [inline] consume_skb+0x23/0xf0 net/core/skbuff.c:910 __sk_msg_free+0x198/0x340 net/core/skmsg.c:196 sk_msg_free net/core/skmsg.c:209 [inline] __sk_psock_purge_ingress_msg net/core/skmsg.c:748 [inline] __sk_psock_zap_ingress net/core/skmsg.c:766 [inline] sk_psock_stop+0x3ed/0x630 net/core/skmsg.c:784 sock_map_close+0x256/0x530 net/core/sock_map.c:1520 unix_release+0x6c/0xd0 net/unix/af_unix.c:989 __sock_release+0xbb/0x270 net/socket.c:650 sock_close+0xf/0x20 net/socket.c:1318 __fput+0x204/0x8d0 fs/file_table.c:313 task_work_run+0xc0/0x160 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f0c3024b51b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffc6043a610 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000006 RCX: 00007f0c3024b51b RDX: 0000001b2f5200f8 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000001b2f5200fc R10: 00007ffc604a5090 R11: 0000000000000293 R12: 00007f0c3039db60 R13: 00007f0c3039db60 R14: 00007f0c3039cf60 R15: 0000000000010669 Allocated by task 4321: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:469 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:732 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc+0x271/0x4b0 mm/slub.c:3243 skb_clone+0x125/0x300 net/core/skbuff.c:1519 sk_psock_verdict_recv+0x6d/0x630 net/core/skmsg.c:1159 unix_read_sock+0xc4/0x1e0 net/unix/af_unix.c:2508 sk_psock_verdict_data_ready+0xf8/0x150 net/core/skmsg.c:1202 unix_dgram_sendmsg+0xca0/0x16f0 net/unix/af_unix.c:2029 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg+0xab/0xe0 net/socket.c:725 ____sys_sendmsg+0x392/0x7a0 net/socket.c:2413 ___sys_sendmsg+0xd3/0x150 net/socket.c:2467 __sys_sendmmsg+0x141/0x310 net/socket.c:2553 __do_sys_sendmmsg net/socket.c:2582 [inline] __se_sys_sendmmsg net/socket.c:2579 [inline] __x64_sys_sendmmsg+0x94/0x100 net/socket.c:2579 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 7: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:236 [inline] slab_free_hook mm/slub.c:1728 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1754 slab_free mm/slub.c:3509 [inline] kmem_cache_free+0xd7/0x370 mm/slub.c:3526 kfree_skb include/linux/skbuff.h:1114 [inline] sock_drop include/linux/skmsg.h:310 [inline] sk_psock_backlog+0x86e/0xd20 net/core/skmsg.c:668 process_one_work+0x879/0x1410 kernel/workqueue.c:2307 worker_thread+0x5a0/0xf60 kernel/workqueue.c:2454 kthread+0x299/0x340 kernel/kthread.c:377 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 The buggy address belongs to the object at ffff8880717c03c0 which belongs to the cache skbuff_head_cache of size 224 The buggy address is located 212 bytes inside of 224-byte region [ffff8880717c03c0, ffff8880717c04a0) The buggy address belongs to the page: page:ffffea0001c5f000 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x717c0 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea00006f0c80 dead000000000005 ffff888014bde000 raw: 0000000000000000 00000000000c000c 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 3914, ts 41931614862, free_ts 38083200532 prep_new_page mm/page_alloc.c:2434 [inline] get_page_from_freelist+0xa6f/0x2f10 mm/page_alloc.c:4165 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5389 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab+0x27f/0x3c0 mm/slub.c:1944 new_slab mm/slub.c:2004 [inline] ___slab_alloc+0xbe3/0x12a0 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] kmem_cache_alloc_node+0x190/0x4f0 mm/slub.c:3266 __alloc_skb+0x151/0x270 net/core/skbuff.c:414 alloc_skb include/linux/skbuff.h:1158 [inline] nlmsg_new include/net/netlink.h:953 [inline] mpls_netconf_notify_devconf+0x35/0xc0 net/mpls/af_mpls.c:1188 mpls_dev_sysctl_register+0x1ec/0x2b0 net/mpls/af_mpls.c:1425 mpls_add_dev net/mpls/af_mpls.c:1472 [inline] mpls_dev_notify+0x19a/0x6b0 net/mpls/af_mpls.c:1613 notifier_call_chain+0x94/0x170 kernel/notifier.c:84 call_netdevice_notifiers_extack net/core/dev.c:1931 [inline] call_netdevice_notifiers net/core/dev.c:1945 [inline] register_netdevice+0xdb3/0x13d0 net/core/dev.c:9698 __rtnl_newlink+0x10a1/0x13f0 net/core/rtnetlink.c:3483 rtnl_newlink+0x5a/0x90 net/core/rtnetlink.c:3529 rtnetlink_rcv_msg+0x31d/0x8d0 net/core/rtnetlink.c:5594 netlink_rcv_skb+0x118/0x370 net/netlink/af_netlink.c:2494 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1352 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1404 free_unref_page_prepare mm/page_alloc.c:3325 [inline] free_unref_page_list+0x1a9/0xfa0 mm/page_alloc.c:3441 release_pages+0x223/0xee0 mm/swap.c:980 tlb_batch_pages_flush mm/mmu_gather.c:50 [inline] tlb_flush_mmu_free mm/mmu_gather.c:243 [inline] tlb_flush_mmu mm/mmu_gather.c:250 [inline] tlb_finish_mmu+0x127/0x790 mm/mmu_gather.c:341 exit_mmap+0x1d1/0x580 mm/mmap.c:3180 __mmput+0xed/0x430 kernel/fork.c:1114 exec_mmap fs/exec.c:1029 [inline] begin_new_exec+0xda0/0x29d0 fs/exec.c:1288 load_elf_binary+0xf56/0x3e60 fs/binfmt_elf.c:1001 search_binary_handler fs/exec.c:1727 [inline] exec_binprm fs/exec.c:1768 [inline] bprm_execve fs/exec.c:1837 [inline] bprm_execve+0x669/0x1520 fs/exec.c:1799 do_execveat_common+0x51d/0x700 fs/exec.c:1926 do_execve fs/exec.c:1994 [inline] __do_sys_execve fs/exec.c:2070 [inline] __se_sys_execve fs/exec.c:2065 [inline] __x64_sys_execve+0x8a/0xb0 fs/exec.c:2065 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: ffff8880717c0380: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ffff8880717c0400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880717c0480: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880717c0500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880717c0580: fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================