================================================================== BUG: KASAN: use-after-free in list_empty include/linux/list.h:284 [inline] BUG: KASAN: use-after-free in waitqueue_active include/linux/wait.h:129 [inline] BUG: KASAN: use-after-free in wq_has_sleeper include/linux/wait.h:163 [inline] BUG: KASAN: use-after-free in skwq_has_sleeper include/net/sock.h:2294 [inline] BUG: KASAN: use-after-free in sock_def_write_space+0x62e/0x640 net/core/sock.c:3159 Read of size 8 at addr ffff88804df97880 by task jbd2/sda1-8/2936 CPU: 1 PID: 2936 Comm: jbd2/sda1-8 Not tainted 5.16.0-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+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 list_empty include/linux/list.h:284 [inline] waitqueue_active include/linux/wait.h:129 [inline] wq_has_sleeper include/linux/wait.h:163 [inline] skwq_has_sleeper include/net/sock.h:2294 [inline] sock_def_write_space+0x62e/0x640 net/core/sock.c:3159 sock_wfree+0x1cc/0x240 net/core/sock.c:2291 skb_release_head_state+0x9f/0x2a0 net/core/skbuff.c:729 skb_release_all net/core/skbuff.c:740 [inline] napi_consume_skb+0x1b5/0x340 net/core/skbuff.c:992 free_old_xmit_skbs+0xe4/0x270 drivers/net/virtio_net.c:1484 virtnet_poll_tx+0x21d/0x5d0 drivers/net/virtio_net.c:1619 __napi_poll+0xaf/0x440 net/core/dev.c:6365 napi_poll net/core/dev.c:6432 [inline] net_rx_action+0x801/0xb40 net/core/dev.c:6519 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 common_interrupt+0xa9/0xc0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:629 RIP: 0010:finish_task_switch.isra.0+0x323/0xb80 kernel/sched/core.c:4852 Code: 53 33 f8 07 85 c0 75 02 0f 0b 48 85 db 0f 85 25 01 00 00 4c 89 f7 e8 fc f7 ff ff e8 a7 41 2d 00 fb 65 48 8b 1c 25 40 70 02 00 <48> 8d bb 80 15 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 RSP: 0018:ffffc9000cfdf498 EFLAGS: 00000202 RAX: 00000000002d7551 RBX: ffff88807f0ad700 RCX: 1ffffffff1b24b81 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000000 RBP: ffffc9000cfdf4e0 R08: 0000000000000001 R09: 0000000000000001 R10: ffffffff817db708 R11: 0000000000000001 R12: ffff8880b9d3a7d8 R13: ffff88801c21ba00 R14: ffff8880b9d39a80 R15: ffff8880b9d3a4b8 context_switch kernel/sched/core.c:4975 [inline] __schedule+0xaa2/0x4900 kernel/sched/core.c:6253 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:6419 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline] _raw_spin_unlock_irq+0x3c/0x40 kernel/locking/spinlock.c:202 spin_unlock_irq include/linux/spinlock.h:399 [inline] blk_insert_flush+0x367/0x4b0 block/blk-flush.c:441 blk_mq_submit_bio+0x151a/0x22b0 block/blk-mq.c:2652 __submit_bio block/blk-core.c:851 [inline] __submit_bio_noacct_mq block/blk-core.c:926 [inline] submit_bio_noacct block/blk-core.c:952 [inline] submit_bio_noacct+0x82c/0xa20 block/blk-core.c:941 submit_bio block/blk-core.c:1013 [inline] submit_bio+0x1ea/0x430 block/blk-core.c:971 submit_bh_wbc+0x5e8/0x7e0 fs/buffer.c:3054 journal_submit_commit_record.part.0+0x859/0xa00 fs/jbd2/commit.c:156 journal_submit_commit_record fs/jbd2/commit.c:128 [inline] jbd2_journal_commit_transaction+0x3fea/0x6c20 fs/jbd2/commit.c:925 kjournald2+0x1d0/0x930 fs/jbd2/journal.c:213 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 12904: 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:437 [inline] __kasan_slab_alloc+0x90/0xc0 mm/kasan/common.c:470 kasan_slab_alloc include/linux/kasan.h:260 [inline] slab_post_alloc_hook mm/slab.h:738 [inline] slab_alloc_node mm/slub.c:3230 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc+0x142/0x3a0 mm/slub.c:3243 sock_alloc_inode+0x18/0x1c0 net/socket.c:304 alloc_inode+0x61/0x230 fs/inode.c:235 new_inode_pseudo+0x14/0xe0 fs/inode.c:944 sock_alloc+0x3c/0x260 net/socket.c:627 __sock_create+0xb9/0x790 net/socket.c:1432 sock_create net/socket.c:1519 [inline] __sys_socket+0xef/0x200 net/socket.c:1561 __do_sys_socket net/socket.c:1570 [inline] __se_sys_socket net/socket.c:1568 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1568 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 12902: 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:367 [inline] ____kasan_slab_free+0x130/0x160 mm/kasan/common.c:329 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+0xd8/0x340 mm/slub.c:3526 i_callback+0x3f/0x70 fs/inode.c:224 rcu_do_batch kernel/rcu/tree.c:2506 [inline] rcu_core+0x7ab/0x14a0 kernel/rcu/tree.c:2741 __do_softirq+0x29b/0x9c2 kernel/softirq.c:558 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 destroy_inode+0x129/0x1b0 fs/inode.c:290 iput_final fs/inode.c:1670 [inline] iput.part.0+0x562/0x820 fs/inode.c:1696 iput+0x58/0x70 fs/inode.c:1686 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:376 __dentry_kill+0x3c0/0x640 fs/dcache.c:582 dentry_kill fs/dcache.c:708 [inline] dput+0x73d/0xbd0 fs/dcache.c:888 __fput+0x3ab/0x9f0 fs/file_table.c:293 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 get_signal+0x1bef/0x2220 kernel/signal.c:2624 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/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 Second to last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xbe/0xd0 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 destroy_inode+0x129/0x1b0 fs/inode.c:290 iput_final fs/inode.c:1670 [inline] iput.part.0+0x562/0x820 fs/inode.c:1696 iput+0x58/0x70 fs/inode.c:1686 dentry_unlink_inode+0x2b1/0x460 fs/dcache.c:376 __dentry_kill+0x3c0/0x640 fs/dcache.c:582 dentry_kill fs/dcache.c:708 [inline] dput+0x73d/0xbd0 fs/dcache.c:888 __fput+0x3ab/0x9f0 fs/file_table.c:293 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xc14/0x2b40 kernel/exit.c:832 do_group_exit+0x125/0x310 kernel/exit.c:929 get_signal+0x47d/0x2220 kernel/signal.c:2852 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/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 The buggy address belongs to the object at ffff88804df97800 which belongs to the cache sock_inode_cache of size 1408 The buggy address is located 128 bytes inside of 1408-byte region [ffff88804df97800, ffff88804df97d80) The buggy address belongs to the page: page:ffffea000137e400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4df90 head:ffffea000137e400 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88807e075201 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888015be53c0 raw: 0000000000000000 0000000000150015 00000001ffffffff ffff88807e075201 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 3634, ts 129371115367, free_ts 14653465148 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2190 alloc_slab_page mm/slub.c:1799 [inline] allocate_slab mm/slub.c:1944 [inline] new_slab+0x28a/0x3b0 mm/slub.c:2004 ___slab_alloc+0x87c/0xe90 mm/slub.c:3018 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3105 slab_alloc_node mm/slub.c:3196 [inline] slab_alloc mm/slub.c:3238 [inline] kmem_cache_alloc+0x35c/0x3a0 mm/slub.c:3243 sock_alloc_inode+0x18/0x1c0 net/socket.c:304 alloc_inode+0x61/0x230 fs/inode.c:235 new_inode_pseudo+0x14/0xe0 fs/inode.c:944 sock_alloc+0x3c/0x260 net/socket.c:627 __sock_create+0xb9/0x790 net/socket.c:1432 udp_sock_create6+0xc5/0x690 net/ipv6/ip6_udp_tunnel.c:23 udp_sock_create include/net/udp_tunnel.h:62 [inline] wg_socket_init+0x4dd/0xa60 drivers/net/wireguard/socket.c:397 wg_open+0x233/0x4a0 drivers/net/wireguard/device.c:49 __dev_open+0x2c4/0x4d0 net/core/dev.c:1407 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 free_contig_range+0xa8/0xf0 mm/page_alloc.c:9271 destroy_args+0xa8/0x646 mm/debug_vm_pgtable.c:1016 debug_vm_pgtable+0x2961/0x29f3 mm/debug_vm_pgtable.c:1330 do_one_initcall+0x103/0x650 init/main.c:1297 do_initcall_level init/main.c:1370 [inline] do_initcalls init/main.c:1386 [inline] do_basic_setup init/main.c:1405 [inline] kernel_init_freeable+0x6b1/0x73a init/main.c:1610 kernel_init+0x1a/0x1d0 init/main.c:1499 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Memory state around the buggy address: ffff88804df97780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88804df97800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804df97880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804df97900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804df97980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 4 bytes skipped: 0: 85 c0 test %eax,%eax 2: 75 02 jne 0x6 4: 0f 0b ud2 6: 48 85 db test %rbx,%rbx 9: 0f 85 25 01 00 00 jne 0x134 f: 4c 89 f7 mov %r14,%rdi 12: e8 fc f7 ff ff callq 0xfffff813 17: e8 a7 41 2d 00 callq 0x2d41c3 1c: fb sti 1d: 65 48 8b 1c 25 40 70 mov %gs:0x27040,%rbx 24: 02 00 * 26: 48 8d bb 80 15 00 00 lea 0x1580(%rbx),%rdi <-- trapping instruction 2d: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax 34: fc ff df 37: 48 89 fa mov %rdi,%rdx 3a: 48 rex.W 3b: c1 .byte 0xc1