================================================================== BUG: KASAN: use-after-free in decode_session6 net/xfrm/xfrm_policy.c:3382 [inline] BUG: KASAN: use-after-free in __xfrm_decode_session+0x19de/0x23e0 net/xfrm/xfrm_policy.c:3489 Read of size 1 at addr ffff88808548e34d by task syz-executor.1/19308 CPU: 0 PID: 19308 Comm: syz-executor.1 Not tainted 5.15.138-syzkaller #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+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 decode_session6 net/xfrm/xfrm_policy.c:3382 [inline] __xfrm_decode_session+0x19de/0x23e0 net/xfrm/xfrm_policy.c:3489 xfrm_decode_session_reverse include/net/xfrm.h:1163 [inline] icmpv6_route_lookup+0x42f/0x650 net/ipv6/icmp.c:394 icmp6_send+0x1352/0x21e0 net/ipv6/icmp.c:601 __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:2790 dst_link_failure include/net/dst.h:422 [inline] ip6_tnl_xmit+0x10d5/0x2500 net/ipv6/ip6_tunnel.c:1265 ipxip6_tnl_xmit net/ipv6/ip6_tunnel.c:1381 [inline] ip6_tnl_start_xmit+0xbe0/0x1470 net/ipv6/ip6_tunnel.c:1430 __netdev_start_xmit include/linux/netdevice.h:5019 [inline] netdev_start_xmit include/linux/netdevice.h:5033 [inline] xmit_one net/core/dev.c:3614 [inline] dev_hard_start_xmit+0x298/0x7a0 net/core/dev.c:3630 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 __dev_xmit_skb net/core/dev.c:3899 [inline] __dev_queue_xmit+0xf0a/0x3230 net/core/dev.c:4210 neigh_output include/net/neighbour.h:509 [inline] ip6_finish_output2+0xee8/0x14f0 net/ipv6/ip6_output.c:126 ip6_send_skb+0x12b/0x240 net/ipv6/ip6_output.c:1937 rawv6_push_pending_frames+0x749/0x9a0 net/ipv6/raw.c:617 rawv6_sendmsg+0x171d/0x2100 net/ipv6/raw.c:961 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 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:0x7f59f1378ae9 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:00007f59ef8fa0c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f59f1497f80 RCX: 00007f59f1378ae9 RDX: 0000000000000000 RSI: 0000000020000080 RDI: 0000000000000003 RBP: 00007f59f13c447a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f59f1497f80 R15: 00007ffdcf18c298 Allocated by task 2951: 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] kmem_cache_alloc_trace+0x143/0x290 mm/slub.c:3247 kmalloc include/linux/slab.h:591 [inline] syslog_print+0x11d/0x9b0 kernel/printk/printk.c:1500 do_syslog+0x842/0x940 kernel/printk/printk.c:1679 __do_sys_syslog kernel/printk/printk.c:1771 [inline] __se_sys_syslog kernel/printk/printk.c:1769 [inline] __x64_sys_syslog+0x78/0x90 kernel/printk/printk.c:1769 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 2951: 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 syslog_print+0x919/0x9b0 kernel/printk/printk.c:1592 do_syslog+0x842/0x940 kernel/printk/printk.c:1679 __do_sys_syslog kernel/printk/printk.c:1771 [inline] __se_sys_syslog kernel/printk/printk.c:1769 [inline] __x64_sys_syslog+0x78/0x90 kernel/printk/printk.c:1769 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 ffff88808548e000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 845 bytes inside of 1024-byte region [ffff88808548e000, ffff88808548e400) The buggy address belongs to the page: page:ffffea0002152200 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x85488 head:ffffea0002152200 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888011c41dc0 raw: 0000000000000000 0000000080100010 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 0x1f2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_MEMALLOC|__GFP_HARDWALL), pid 10137, ts 1614384561457, free_ts 1529797484622 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] __kmalloc_node_track_caller+0x1f6/0x390 mm/slub.c:4958 kmalloc_reserve net/core/skbuff.c:356 [inline] __alloc_skb+0x12c/0x590 net/core/skbuff.c:427 __netdev_alloc_skb+0xfb/0x4e0 net/core/skbuff.c:494 __netdev_alloc_skb_ip_align include/linux/skbuff.h:3009 [inline] netdev_alloc_skb_ip_align include/linux/skbuff.h:3019 [inline] batadv_iv_ogm_aggregate_new net/batman-adv/bat_iv_ogm.c:559 [inline] batadv_iv_ogm_queue_add+0x6a0/0xbe0 net/batman-adv/bat_iv_ogm.c:671 batadv_iv_ogm_schedule_buff net/batman-adv/bat_iv_ogm.c:850 [inline] batadv_iv_ogm_schedule+0xb7e/0x1000 net/batman-adv/bat_iv_ogm.c:869 batadv_iv_send_outstanding_bat_ogm_packet+0x6fa/0x800 net/batman-adv/bat_iv_ogm.c:1713 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457 kthread+0x3f6/0x4f0 kernel/kthread.c:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 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_pages_ok+0x9ef/0xaa0 mm/page_alloc.c:1643 free_nonslab_page+0xe4/0x150 mm/slub.c:3535 kfree+0x1cf/0x270 mm/slub.c:4556 skb_free_head net/core/skbuff.c:655 [inline] skb_release_data+0x73a/0x8a0 net/core/skbuff.c:677 skb_release_all net/core/skbuff.c:742 [inline] __kfree_skb net/core/skbuff.c:756 [inline] kfree_skb_reason+0xb3/0x170 net/core/skbuff.c:776 tipc_recvstream+0x807/0xf70 net/tipc/socket.c:2092 ____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 Memory state around the buggy address: ffff88808548e200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88808548e280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88808548e300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88808548e380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88808548e400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================