================================================================== BUG: KASAN: use-after-free in sk_fullsock include/net/sock.h:2746 [inline] BUG: KASAN: use-after-free in ip_skb_dst_mtu+0x84a/0x9d0 include/net/ip.h:478 Read of size 1 at addr ffff88807ba8c012 by task syz-executor.2/3894 CPU: 0 PID: 3894 Comm: syz-executor.2 Not tainted 5.15.148-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x63/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:451 sk_fullsock include/net/sock.h:2746 [inline] ip_skb_dst_mtu+0x84a/0x9d0 include/net/ip.h:478 __ip_finish_output+0x133/0x4a0 net/ipv4/ip_output.c:299 ipvlan_process_v4_outbound+0x3cb/0x6b0 drivers/net/ipvlan/ipvlan_core.c:443 ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:541 [inline] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:604 [inline] ipvlan_queue_xmit+0xa4c/0x1150 drivers/net/ipvlan/ipvlan_core.c:670 ipvlan_start_xmit+0x46/0x180 drivers/net/ipvlan/ipvlan_main.c:222 __netdev_start_xmit include/linux/netdevice.h:5019 [inline] netdev_start_xmit include/linux/netdevice.h:5033 [inline] xmit_one net/core/dev.c:3617 [inline] dev_hard_start_xmit+0x298/0x7a0 net/core/dev.c:3633 sch_direct_xmit+0x2b2/0x5e0 net/sched/sch_generic.c:342 qdisc_restart net/sched/sch_generic.c:407 [inline] __qdisc_run+0xae2/0x1e90 net/sched/sch_generic.c:415 qdisc_run+0x10d/0x320 include/net/pkt_sched.h:132 net_tx_action+0x73a/0x8e0 net/core/dev.c:5088 __do_softirq+0x3b3/0x93a kernel/softirq.c:558 invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x155/0x240 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x91/0xb0 arch/x86/kernel/apic/apic.c:1096 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:638 RIP: 0010:rmqueue mm/page_alloc.c:3690 [inline] RIP: 0010:get_page_from_freelist+0x2976/0x33c0 mm/page_alloc.c:4156 Code: 0f e8 8e 15 0a 00 48 ba 00 00 00 00 00 fc ff df f6 84 24 01 02 00 00 02 0f 85 b0 04 00 00 41 f7 c4 00 02 00 00 74 01 fb 31 c0 <48> 89 44 24 20 4d 85 f6 0f 84 55 01 00 00 4c 89 f3 49 c1 ee 03 41 RSP: 0018:ffffc90002dc7020 EFLAGS: 00000246 RAX: 0000000000000000 RBX: 1ffff920005b8e44 RCX: ffffffff8162ee28 RDX: dffffc0000000000 RSI: ffffffff8a8b0f80 RDI: ffffc90002dc7220 RBP: ffffc90002dc72d0 R08: dffffc0000000000 R09: fffffbfff1f7a03b R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000000000246 R13: 0000000000000981 R14: ffffea0000f96040 R15: ffff8880b9a3fd40 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421 __page_cache_alloc+0xd4/0x4a0 mm/filemap.c:1022 page_cache_ra_unbounded+0x2b1/0x930 mm/readahead.c:216 page_cache_async_readahead include/linux/pagemap.h:856 [inline] do_async_mmap_readahead mm/filemap.c:3023 [inline] filemap_fault+0x669/0x1470 mm/filemap.c:3079 __do_fault+0x139/0x340 mm/memory.c:3898 do_read_fault mm/memory.c:4234 [inline] do_fault mm/memory.c:4362 [inline] handle_pte_fault mm/memory.c:4621 [inline] __handle_mm_fault mm/memory.c:4756 [inline] handle_mm_fault+0x376f/0x5950 mm/memory.c:4854 faultin_page mm/gup.c:976 [inline] __get_user_pages+0x4ed/0x11d0 mm/gup.c:1197 populate_vma_page_range+0x215/0x2a0 mm/gup.c:1529 __mm_populate+0x2a5/0x4a0 mm/gup.c:1638 mm_populate include/linux/mm.h:2632 [inline] vm_mmap_pgoff+0x22b/0x2d0 mm/util.c:556 ksys_mmap_pgoff+0x559/0x780 mm/mmap.c:1624 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:0x7fbedd63cda9 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:00007fbedbb9c0c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 00007fbedd76b050 RCX: 00007fbedd63cda9 RDX: 00000000027fffff RSI: 0000000000600000 RDI: 0000000020000000 RBP: 00007fbedd68947a R08: 0000000000000004 R09: 0000000000000000 R10: 0000000004002011 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000006e R14: 00007fbedd76b050 R15: 00007fff01a4a168 Allocated by task 3916: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc+0xba/0xf0 mm/kasan/common.c:513 kasan_kmalloc include/linux/kasan.h:264 [inline] __kmalloc+0x168/0x300 mm/slub.c:4407 kmalloc include/linux/slab.h:596 [inline] sk_prot_alloc+0xe0/0x200 net/core/sock.c:1852 sk_alloc+0x35/0x310 net/core/sock.c:1905 packet_create+0x100/0x7a0 net/packet/af_packet.c:3316 __sock_create+0x460/0x8d0 net/socket.c:1486 sock_create net/socket.c:1537 [inline] __sys_socket+0x132/0x370 net/socket.c:1579 __do_sys_socket net/socket.c:1588 [inline] __se_sys_socket net/socket.c:1586 [inline] __x64_sys_socket+0x76/0x80 net/socket.c:1586 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 3894: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0xf1/0x270 mm/slub.c:4559 sk_prot_free net/core/sock.c:1888 [inline] __sk_destruct+0x58e/0x840 net/core/sock.c:1974 skb_orphan include/linux/skbuff.h:2896 [inline] ip_defrag+0x203/0x2590 net/ipv4/ip_fragment.c:482 nf_ct_ipv4_gather_frags net/ipv4/netfilter/nf_defrag_ipv4.c:31 [inline] ipv4_conntrack_defrag+0x3b1/0x580 net/ipv4/netfilter/nf_defrag_ipv4.c:86 nf_hook_entry_hookfn include/linux/netfilter.h:142 [inline] nf_hook_slow+0xae/0x1e0 net/netfilter/core.c:584 nf_hook+0x2a6/0x430 include/linux/netfilter.h:257 __ip_local_out+0x3b2/0x4f0 net/ipv4/ip_output.c:115 ip_local_out+0x26/0x120 net/ipv4/ip_output.c:124 ipvlan_process_v4_outbound+0x3cb/0x6b0 drivers/net/ipvlan/ipvlan_core.c:443 ipvlan_process_outbound drivers/net/ipvlan/ipvlan_core.c:541 [inline] ipvlan_xmit_mode_l3 drivers/net/ipvlan/ipvlan_core.c:604 [inline] ipvlan_queue_xmit+0xa4c/0x1150 drivers/net/ipvlan/ipvlan_core.c:670 ipvlan_start_xmit+0x46/0x180 drivers/net/ipvlan/ipvlan_main.c:222 __netdev_start_xmit include/linux/netdevice.h:5019 [inline] netdev_start_xmit include/linux/netdevice.h:5033 [inline] xmit_one net/core/dev.c:3617 [inline] dev_hard_start_xmit+0x298/0x7a0 net/core/dev.c:3633 sch_direct_xmit+0x2b2/0x5e0 net/sched/sch_generic.c:342 qdisc_restart net/sched/sch_generic.c:407 [inline] __qdisc_run+0xae2/0x1e90 net/sched/sch_generic.c:415 qdisc_run+0x10d/0x320 include/net/pkt_sched.h:132 net_tx_action+0x73a/0x8e0 net/core/dev.c:5088 __do_softirq+0x3b3/0x93a kernel/softirq.c:558 The buggy address belongs to the object at ffff88807ba8c000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 18 bytes inside of 4096-byte region [ffff88807ba8c000, ffff88807ba8d000) The buggy address belongs to the page: page:ffffea0001eea200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7ba88 head:ffffea0001eea200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011c42140 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 3544, ts 163807024528, free_ts 163641922486 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421 alloc_slab_page mm/slub.c:1775 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xbb/0x4b0 mm/slub.c:1975 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008 __slab_alloc mm/slub.c:3095 [inline] slab_alloc_node mm/slub.c:3186 [inline] slab_alloc mm/slub.c:3228 [inline] __kmalloc+0x1c9/0x300 mm/slub.c:4403 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xd8/0x5e0 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x225/0x810 security/tomoyo/file.c:723 security_file_ioctl+0x6d/0xa0 security/security.c:1555 __do_sys_ioctl fs/ioctl.c:868 [inline] __se_sys_ioctl+0x47/0x160 fs/ioctl.c:860 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396 free_slab mm/slub.c:2015 [inline] discard_slab mm/slub.c:2021 [inline] __unfreeze_partials+0x1b7/0x210 mm/slub.c:2507 put_cpu_partial+0x132/0x1a0 mm/slub.c:2587 do_slab_free mm/slub.c:3487 [inline] ___cache_free+0xe3/0x100 mm/slub.c:3506 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x53/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3220 [inline] slab_alloc mm/slub.c:3228 [inline] __kmalloc+0x120/0x300 mm/slub.c:4403 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xd8/0x5e0 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x273/0x6b0 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x120 security/security.c:1348 vfs_getattr+0x26/0x360 fs/stat.c:157 vfs_statx+0x18f/0x3b0 fs/stat.c:225 vfs_fstatat fs/stat.c:243 [inline] __do_sys_newfstatat fs/stat.c:411 [inline] __se_sys_newfstatat fs/stat.c:405 [inline] __x64_sys_newfstatat+0x12c/0x1b0 fs/stat.c:405 Memory state around the buggy address: ffff88807ba8bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88807ba8bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88807ba8c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807ba8c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807ba8c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 1 bytes skipped: 0: e8 8e 15 0a 00 call 0xa1593 5: 48 ba 00 00 00 00 00 movabs $0xdffffc0000000000,%rdx c: fc ff df f: f6 84 24 01 02 00 00 testb $0x2,0x201(%rsp) 16: 02 17: 0f 85 b0 04 00 00 jne 0x4cd 1d: 41 f7 c4 00 02 00 00 test $0x200,%r12d 24: 74 01 je 0x27 26: fb sti 27: 31 c0 xor %eax,%eax * 29: 48 89 44 24 20 mov %rax,0x20(%rsp) <-- trapping instruction 2e: 4d 85 f6 test %r14,%r14 31: 0f 84 55 01 00 00 je 0x18c 37: 4c 89 f3 mov %r14,%rbx 3a: 49 c1 ee 03 shr $0x3,%r14 3e: 41 rex.B