================================================================== BUG: KASAN: use-after-free in decode_session6 net/xfrm/xfrm_policy.c:3375 [inline] BUG: KASAN: use-after-free in __xfrm_decode_session+0x19de/0x23e0 net/xfrm/xfrm_policy.c:3481 Read of size 1 at addr ffff88807c18f2e8 by task syz-executor.2/21555 CPU: 0 PID: 21555 Comm: syz-executor.2 Not tainted 6.1.28-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/28/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description mm/kasan/report.c:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 decode_session6 net/xfrm/xfrm_policy.c:3375 [inline] __xfrm_decode_session+0x19de/0x23e0 net/xfrm/xfrm_policy.c:3481 xfrm_decode_session_reverse include/net/xfrm.h:1175 [inline] icmpv6_route_lookup+0x44a/0x680 net/ipv6/icmp.c:386 icmp6_send+0x1258/0x20d0 net/ipv6/icmp.c:590 __icmpv6_send include/linux/icmpv6.h:28 [inline] icmpv6_send include/linux/icmpv6.h:49 [inline] ip6_link_failure+0x37/0x4a0 net/ipv6/route.c:2786 dst_link_failure include/net/dst.h:423 [inline] ip6_tnl_xmit+0x1055/0x28c0 net/ipv6/ip6_tunnel.c:1269 ipxip6_tnl_xmit net/ipv6/ip6_tunnel.c:1385 [inline] ip6_tnl_start_xmit+0xbd7/0x1460 net/ipv6/ip6_tunnel.c:1434 __netdev_start_xmit include/linux/netdevice.h:4849 [inline] netdev_start_xmit include/linux/netdevice.h:4863 [inline] xmit_one net/core/dev.c:3593 [inline] dev_hard_start_xmit+0x261/0x8c0 net/core/dev.c:3609 sch_direct_xmit+0x2b2/0x5e0 net/sched/sch_generic.c:342 qdisc_restart net/sched/sch_generic.c:407 [inline] __qdisc_run+0xb16/0x1f30 net/sched/sch_generic.c:415 __dev_xmit_skb net/core/dev.c:3883 [inline] __dev_queue_xmit+0x1126/0x3c20 net/core/dev.c:4225 neigh_output include/net/neighbour.h:546 [inline] ip6_finish_output2+0xf9f/0x15b0 net/ipv6/ip6_output.c:134 ip6_fragment+0x119c/0x23d0 net/ipv6/ip6_output.c:1007 __ip6_finish_output net/ipv6/ip6_output.c:193 [inline] ip6_finish_output+0x579/0xa80 net/ipv6/ip6_output.c:206 ip6_send_skb+0x12b/0x240 net/ipv6/ip6_output.c:1989 rawv6_push_pending_frames+0x7a4/0xa00 net/ipv6/raw.c:580 rawv6_sendmsg+0x174e/0x2150 net/ipv6/raw.c:923 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] kernel_sendmsg+0xf5/0x130 net/socket.c:756 sock_no_sendpage+0x162/0x1e0 net/core/sock.c:3222 kernel_sendpage+0x2f6/0x640 net/socket.c:3561 sock_sendpage+0x7f/0xb0 net/socket.c:1059 pipe_to_sendpage+0x260/0x350 fs/splice.c:361 splice_from_pipe_feed fs/splice.c:415 [inline] __splice_from_pipe+0x33b/0x890 fs/splice.c:559 splice_from_pipe fs/splice.c:594 [inline] generic_splice_sendpage+0x195/0x220 fs/splice.c:743 do_splice_from fs/splice.c:764 [inline] do_splice+0xfdb/0x1790 fs/splice.c:1074 __do_splice fs/splice.c:1139 [inline] __do_sys_splice fs/splice.c:1346 [inline] __se_sys_splice+0x340/0x420 fs/splice.c:1328 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+0x63/0xcd RIP: 0033:0x7fc6f548c169 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 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 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fc6f6247168 EFLAGS: 00000246 ORIG_RAX: 0000000000000113 RAX: ffffffffffffffda RBX: 00007fc6f55abf80 RCX: 00007fc6f548c169 RDX: 0000000000000005 RSI: 0000000000000000 RDI: 0000000000000003 RBP: 00007fc6f54e7ca1 R08: 0000000080000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd0d24da6f R14: 00007fc6f6247300 R15: 0000000000022000 Allocated by task 21133: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383 kmalloc include/linux/slab.h:553 [inline] rtnl_newlink+0xe8/0x1fa0 net/core/rtnetlink.c:3590 rtnetlink_rcv_msg+0x776/0xf00 net/core/rtnetlink.c:6091 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2524 netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline] netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1354 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1902 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] __sys_sendto+0x471/0x5f0 net/socket.c:2117 __do_sys_sendto net/socket.c:2129 [inline] __se_sys_sendto net/socket.c:2125 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2125 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+0x63/0xcd Freed by task 21133: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook mm/slub.c:1750 [inline] slab_free mm/slub.c:3661 [inline] __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674 rtnl_newlink+0x1586/0x1fa0 net/core/rtnetlink.c:3595 rtnetlink_rcv_msg+0x776/0xf00 net/core/rtnetlink.c:6091 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2524 netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline] netlink_unicast+0x7bf/0x990 net/netlink/af_netlink.c:1354 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1902 sock_sendmsg_nosec net/socket.c:716 [inline] sock_sendmsg net/socket.c:736 [inline] __sys_sendto+0x471/0x5f0 net/socket.c:2117 __do_sys_sendto net/socket.c:2129 [inline] __se_sys_sendto net/socket.c:2125 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2125 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+0x63/0xcd The buggy address belongs to the object at ffff88807c18f000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 744 bytes inside of 2048-byte region [ffff88807c18f000, ffff88807c18f800) The buggy address belongs to the physical page: page:ffffea0001f06200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7c188 head:ffffea0001f06200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000001 ffff888012442000 raw: 0000000000000000 0000000080080008 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 0x1d2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 21133, tgid 21133 (syz-executor.1), ts 2537084328475, free_ts 2536670903915 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2533 prep_new_page mm/page_alloc.c:2540 [inline] get_page_from_freelist+0x32ed/0x3480 mm/page_alloc.c:4292 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5559 alloc_slab_page+0x6a/0x150 mm/slub.c:1794 allocate_slab mm/slub.c:1939 [inline] new_slab+0x84/0x2d0 mm/slub.c:1992 ___slab_alloc+0xa71/0x1080 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node_track_caller+0xa0/0x220 mm/slab_common.c:975 kmalloc_reserve net/core/skbuff.c:437 [inline] __alloc_skb+0x126/0x620 net/core/skbuff.c:509 alloc_skb include/linux/skbuff.h:1268 [inline] nlmsg_new include/net/netlink.h:970 [inline] inet6_ifinfo_notify+0x69/0x110 net/ipv6/addrconf.c:6052 addrconf_notify+0xc56/0xf60 net/ipv6/addrconf.c:3662 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455 __dev_notify_flags+0x304/0x610 dev_change_flags+0xe7/0x190 net/core/dev.c:8622 do_setlink+0xf5d/0x3e60 net/core/rtnetlink.c:2788 __rtnl_newlink net/core/rtnetlink.c:3547 [inline] rtnl_newlink+0x16f7/0x1fa0 net/core/rtnetlink.c:3594 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1460 [inline] free_pcp_prepare mm/page_alloc.c:1510 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3388 free_unref_page+0x98/0x570 mm/page_alloc.c:3484 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x1b7/0x210 mm/slub.c:2586 put_cpu_partial+0x116/0x180 mm/slub.c:2662 qlist_free_all+0x22/0x60 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x1f/0x70 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x50/0x370 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] __kmem_cache_alloc_node+0x137/0x260 mm/slub.c:3437 __do_kmalloc_node mm/slab_common.c:954 [inline] __kmalloc_node+0xa2/0x230 mm/slab_common.c:962 kmalloc_array_node include/linux/slab.h:666 [inline] kcalloc_node include/linux/slab.h:671 [inline] memcg_alloc_slab_cgroups+0x7d/0x120 mm/memcontrol.c:2885 account_slab mm/slab.h:635 [inline] allocate_slab mm/slub.c:1957 [inline] new_slab+0xc0/0x2d0 mm/slub.c:1992 ___slab_alloc+0xa71/0x1080 mm/slub.c:3180 __slab_alloc mm/slub.c:3279 [inline] slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x1a5/0x2d0 mm/slub.c:3422 vm_area_alloc+0x20/0xe0 kernel/fork.c:458 mmap_region+0xcbb/0x1fa0 mm/mmap.c:2643 Memory state around the buggy address: ffff88807c18f180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c18f200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807c18f280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807c18f300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c18f380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================