================================================================== BUG: KASAN: use-after-free in skb_headlen include/linux/skbuff.h:2237 [inline] BUG: KASAN: use-after-free in __skb_datagram_iter+0x6f8/0x760 net/core/datagram.c:417 Read of size 4 at addr ffff8881259f7e30 by task syz-executor.0/877 CPU: 0 PID: 877 Comm: syz-executor.0 Not tainted 5.15.137-syzkaller-1068730-g61cfd264993d #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/09/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 skb_headlen include/linux/skbuff.h:2237 [inline] __skb_datagram_iter+0x6f8/0x760 net/core/datagram.c:417 skb_copy_datagram_iter+0x43/0x170 net/core/datagram.c:533 skb_copy_datagram_msg include/linux/skbuff.h:3748 [inline] unix_stream_read_actor+0x70/0xb0 net/unix/af_unix.c:2809 unix_stream_recv_urg+0x1b4/0x2f0 net/unix/af_unix.c:2535 unix_stream_read_generic+0x2147/0x2240 net/unix/af_unix.c:2615 unix_stream_recvmsg+0x22d/0x2c0 net/unix/af_unix.c:2847 ____sys_recvmsg+0x286/0x530 ___sys_recvmsg+0x1ec/0x690 net/socket.c:2690 __sys_recvmsg net/socket.c:2720 [inline] __do_sys_recvmsg net/socket.c:2730 [inline] __se_sys_recvmsg net/socket.c:2727 [inline] __x64_sys_recvmsg+0x1dc/0x2b0 net/socket.c:2727 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7ff5cccaaae9 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 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 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff5cc7eb0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002f RAX: ffffffffffffffda RBX: 00007ff5ccdca120 RCX: 00007ff5cccaaae9 RDX: 0000000040010083 RSI: 0000000020000140 RDI: 0000000000000004 RBP: 00007ff5cccf647a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007ff5ccdca120 R15: 00007ffcc19649a8 Allocated by task 876: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:433 [inline] __kasan_slab_alloc+0xb1/0xe0 mm/kasan/common.c:466 kasan_slab_alloc include/linux/kasan.h:217 [inline] slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:550 slab_alloc_node mm/slub.c:3240 [inline] slab_alloc mm/slub.c:3248 [inline] kmem_cache_alloc+0xf5/0x200 mm/slub.c:3253 kmem_cache_alloc_node include/linux/slab.h:474 [inline] __alloc_skb+0xbe/0x550 net/core/skbuff.c:416 alloc_skb include/linux/skbuff.h:1183 [inline] alloc_skb_with_frags+0xa6/0x680 net/core/skbuff.c:6156 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2518 sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2535 queue_oob+0xfd/0x8c0 net/unix/af_unix.c:1980 unix_stream_sendmsg+0xe06/0x1060 net/unix/af_unix.c:2117 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2429 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2483 __sys_sendmsg net/socket.c:2512 [inline] __do_sys_sendmsg net/socket.c:2521 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2519 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2519 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 876: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373 kasan_slab_free include/linux/kasan.h:193 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749 slab_free mm/slub.c:3519 [inline] kmem_cache_free+0x116/0x2e0 mm/slub.c:3535 kfree_skbmem+0x104/0x170 __kfree_skb net/core/skbuff.c:758 [inline] consume_skb+0xb4/0x250 net/core/skbuff.c:930 queue_oob+0x522/0x8c0 net/unix/af_unix.c:2011 unix_stream_sendmsg+0xe06/0x1060 net/unix/af_unix.c:2117 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2429 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2483 __sys_sendmsg net/socket.c:2512 [inline] __do_sys_sendmsg net/socket.c:2521 [inline] __se_sys_sendmsg+0x19a/0x260 net/socket.c:2519 __x64_sys_sendmsg+0x7b/0x90 net/socket.c:2519 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff8881259f7dc0 which belongs to the cache skbuff_head_cache of size 248 The buggy address is located 112 bytes inside of 248-byte region [ffff8881259f7dc0, ffff8881259f7eb8) The buggy address belongs to the page: page:ffffea0004967dc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1259f7 flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 0000000000000000 dead000000000122 ffff888100350900 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 868, ts 51603901661, free_ts 51485823759 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2602 prep_new_page+0x1b/0x110 mm/page_alloc.c:2608 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4482 __alloc_pages+0x206/0x5e0 mm/page_alloc.c:5773 allocate_slab mm/slub.c:1932 [inline] new_slab+0x9a/0x4e0 mm/slub.c:1995 ___slab_alloc+0x39e/0x830 mm/slub.c:3028 __slab_alloc+0x4a/0x90 mm/slub.c:3115 slab_alloc_node mm/slub.c:3206 [inline] slab_alloc mm/slub.c:3248 [inline] kmem_cache_alloc+0x134/0x200 mm/slub.c:3253 kmem_cache_alloc_node include/linux/slab.h:474 [inline] __alloc_skb+0xbe/0x550 net/core/skbuff.c:416 alloc_skb include/linux/skbuff.h:1183 [inline] alloc_skb_with_frags+0xa6/0x680 net/core/skbuff.c:6156 sock_alloc_send_pskb+0x915/0xa50 net/core/sock.c:2518 sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2535 queue_oob+0xfd/0x8c0 net/unix/af_unix.c:1980 unix_stream_sendmsg+0xe06/0x1060 net/unix/af_unix.c:2117 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x59e/0x8f0 net/socket.c:2429 ___sys_sendmsg+0x252/0x2e0 net/socket.c:2483 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1469 [inline] free_pcp_prepare mm/page_alloc.c:1541 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3531 free_unref_page+0xe6/0x730 mm/page_alloc.c:3613 free_the_page mm/page_alloc.c:802 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5849 free_pages+0x7c/0x90 mm/page_alloc.c:5860 _pgd_free arch/x86/mm/pgtable.c:420 [inline] pgd_free+0x17d/0x190 arch/x86/mm/pgtable.c:476 mm_free_pgd kernel/fork.c:698 [inline] __mmdrop+0xb0/0x410 kernel/fork.c:749 mmdrop include/linux/sched/mm.h:49 [inline] finish_task_switch+0x2cd/0x7b0 kernel/sched/core.c:5044 context_switch kernel/sched/core.c:5150 [inline] __schedule+0xcc6/0x1580 kernel/sched/core.c:6506 schedule+0x11f/0x1e0 kernel/sched/core.c:6589 schedule_hrtimeout_range_clock+0x1ef/0x360 kernel/time/hrtimer.c:2307 schedule_hrtimeout_range+0x2a/0x40 kernel/time/hrtimer.c:2353 freezable_schedule_hrtimeout_range include/linux/freezer.h:275 [inline] ep_poll fs/eventpoll.c:1878 [inline] do_epoll_wait+0x1777/0x1a50 fs/eventpoll.c:2256 do_epoll_pwait+0x5c/0x1f0 fs/eventpoll.c:2290 __do_sys_epoll_pwait fs/eventpoll.c:2303 [inline] __se_sys_epoll_pwait fs/eventpoll.c:2297 [inline] __x64_sys_epoll_pwait+0x2b4/0x300 fs/eventpoll.c:2297 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb Memory state around the buggy address: ffff8881259f7d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc ffff8881259f7d80: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb >ffff8881259f7e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881259f7e80: fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc fc ffff8881259f7f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================