================================================================== BUG: KASAN: slab-use-after-free in decode_session6+0x10e1/0x1950 net/xfrm/xfrm_policy.c:3460 Read of size 1 at addr ffff88802e810c07 by task syz-executor.0/18489 CPU: 0 PID: 18489 Comm: syz-executor.0 Not tainted 6.5.0-rc7-syzkaller-00168-g7d2f353b2682 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0xc4/0x620 mm/kasan/report.c:475 kasan_report+0xda/0x110 mm/kasan/report.c:588 decode_session6+0x10e1/0x1950 net/xfrm/xfrm_policy.c:3460 __xfrm_decode_session+0x54/0xb0 net/xfrm/xfrm_policy.c:3566 xfrm_decode_session_reverse include/net/xfrm.h:1223 [inline] icmpv6_route_lookup+0x397/0x550 net/ipv6/icmp.c:388 icmp6_send+0x11c1/0x2720 net/ipv6/icmp.c:595 __icmpv6_send include/linux/icmpv6.h:28 [inline] icmpv6_ndo_send+0x143/0x620 net/ipv6/ip6_icmp.c:62 ipxip6_tnl_xmit net/ipv6/ip6_tunnel.c:1336 [inline] ip6_tnl_start_xmit+0x1557/0x1750 net/ipv6/ip6_tunnel.c:1432 __netdev_start_xmit include/linux/netdevice.h:4910 [inline] netdev_start_xmit include/linux/netdevice.h:4924 [inline] xmit_one net/core/dev.c:3537 [inline] dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3553 sch_direct_xmit+0x1ac/0xc20 net/sched/sch_generic.c:342 qdisc_restart net/sched/sch_generic.c:407 [inline] __qdisc_run+0x540/0x19d0 net/sched/sch_generic.c:415 __dev_xmit_skb net/core/dev.c:3827 [inline] __dev_queue_xmit+0x26ab/0x3f20 net/core/dev.c:4169 dev_queue_xmit include/linux/netdevice.h:3088 [inline] neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581 neigh_output include/net/neighbour.h:544 [inline] ip6_finish_output2+0x5d0/0x1b20 net/ipv6/ip6_output.c:135 __ip6_finish_output net/ipv6/ip6_output.c:196 [inline] ip6_finish_output+0x485/0x11d0 net/ipv6/ip6_output.c:207 NF_HOOK_COND include/linux/netfilter.h:292 [inline] ip6_output+0x243/0x890 net/ipv6/ip6_output.c:228 dst_output include/net/dst.h:458 [inline] NF_HOOK include/linux/netfilter.h:303 [inline] NF_HOOK include/linux/netfilter.h:297 [inline] ip6_xmit+0xe1d/0x1fe0 net/ipv6/ip6_output.c:344 inet6_csk_xmit+0x3c0/0x730 net/ipv6/inet6_connection_sock.c:135 __tcp_transmit_skb+0x19a4/0x3a80 net/ipv4/tcp_output.c:1401 tcp_transmit_skb net/ipv4/tcp_output.c:1419 [inline] tcp_send_syn_data net/ipv4/tcp_output.c:3888 [inline] tcp_connect+0x21c6/0x5730 net/ipv4/tcp_output.c:3953 tcp_v6_connect+0x147f/0x1fc0 net/ipv6/tcp_ipv6.c:338 __inet_stream_connect+0x947/0xe10 net/ipv4/af_inet.c:666 tcp_sendmsg_fastopen+0x3ce/0x720 net/ipv4/tcp.c:1019 tcp_sendmsg_locked+0x1e5f/0x3420 net/ipv4/tcp.c:1070 tcp_sendmsg+0x2e/0x40 net/ipv4/tcp.c:1333 inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:651 sock_sendmsg_nosec net/socket.c:725 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:748 __sys_sendto+0x255/0x340 net/socket.c:2134 __do_sys_sendto net/socket.c:2146 [inline] __se_sys_sendto net/socket.c:2142 [inline] __ia32_sys_sendto+0xdd/0x1b0 net/socket.c:2142 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 RIP: 0023:0xf7fa9579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f7fa45ac EFLAGS: 00000292 ORIG_RAX: 0000000000000171 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00000000200000c0 RDX: 0000000000000001 RSI: 0000000020008845 RDI: 0000000020b63fe4 RBP: 000000000000001b R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 18290: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0xa2/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:196 [inline] __do_kmalloc_node mm/slab_common.c:985 [inline] __kmalloc+0x5d/0x100 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x271/0x450 security/tomoyo/file.c:822 tomoyo_path_symlink+0x98/0xe0 security/tomoyo/tomoyo.c:211 security_path_symlink+0x101/0x160 security/security.c:1747 do_symlinkat+0x120/0x310 fs/namei.c:4501 __do_sys_symlinkat fs/namei.c:4519 [inline] __se_sys_symlinkat fs/namei.c:4516 [inline] __ia32_sys_symlinkat+0x97/0xc0 fs/namei.c:4516 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 Freed by task 18290: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:522 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x15e/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:162 [inline] slab_free_hook mm/slub.c:1792 [inline] slab_free_freelist_hook+0x10b/0x1e0 mm/slub.c:1818 slab_free mm/slub.c:3801 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3814 tomoyo_realpath_from_path+0x1a6/0x710 security/tomoyo/realpath.c:286 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x271/0x450 security/tomoyo/file.c:822 tomoyo_path_symlink+0x98/0xe0 security/tomoyo/tomoyo.c:211 security_path_symlink+0x101/0x160 security/security.c:1747 do_symlinkat+0x120/0x310 fs/namei.c:4501 __do_sys_symlinkat fs/namei.c:4519 [inline] __se_sys_symlinkat fs/namei.c:4516 [inline] __ia32_sys_symlinkat+0x97/0xc0 fs/namei.c:4516 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 The buggy address belongs to the object at ffff88802e810000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 3079 bytes inside of freed 4096-byte region [ffff88802e810000, ffff88802e811000) The buggy address belongs to the physical page: page:ffffea0000ba0400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2e810 head:ffffea0000ba0400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000010200 ffff888012842140 dead000000000100 dead000000000122 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 10007, tgid 10004 (syz-executor.1), ts 549993616549, free_ts 549900236995 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2d2/0x350 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x10a9/0x31e0 mm/page_alloc.c:3221 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4477 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298 alloc_slab_page mm/slub.c:1862 [inline] allocate_slab+0x24e/0x380 mm/slub.c:2009 new_slab mm/slub.c:2062 [inline] ___slab_alloc+0x8bc/0x1570 mm/slub.c:3215 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3314 __slab_alloc_node mm/slub.c:3367 [inline] slab_alloc_node mm/slub.c:3460 [inline] __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3509 __do_kmalloc_node mm/slab_common.c:984 [inline] __kmalloc+0x4c/0x100 mm/slab_common.c:998 kmalloc include/linux/slab.h:586 [inline] tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x243/0x590 security/tomoyo/file.c:723 security_file_ioctl+0x72/0xb0 security/security.c:2608 __do_compat_sys_ioctl+0x5d/0x330 fs/ioctl.c:920 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x70/0x82 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x508/0xb90 mm/page_alloc.c:2348 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2443 __unfreeze_partials+0x21d/0x240 mm/slub.c:2647 qlink_free mm/kasan/quarantine.c:166 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:185 kasan_quarantine_reduce+0x18b/0x1d0 mm/kasan/quarantine.c:292 __kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:305 kasan_slab_alloc include/linux/kasan.h:186 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3470 [inline] slab_alloc mm/slub.c:3478 [inline] __kmem_cache_alloc_lru mm/slub.c:3485 [inline] kmem_cache_alloc+0x172/0x3b0 mm/slub.c:3494 mt_alloc_one lib/maple_tree.c:159 [inline] mas_alloc_nodes+0x182/0x830 lib/maple_tree.c:1282 mas_node_count_gfp lib/maple_tree.c:1362 [inline] mas_preallocate+0x2b1/0x370 lib/maple_tree.c:5554 vma_iter_prealloc mm/internal.h:1049 [inline] vma_expand+0x26e/0xbd0 mm/mmap.c:666 mmap_region+0x1db5/0x2650 mm/mmap.c:2716 do_mmap+0x884/0xee0 mm/mmap.c:1363 vm_mmap_pgoff+0x1a6/0x3b0 mm/util.c:543 ksys_mmap_pgoff+0x7d/0x5b0 mm/mmap.c:1409 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x61/0xe0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x33/0x70 arch/x86/entry/common.c:203 Memory state around the buggy address: ffff88802e810b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802e810b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88802e810c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802e810c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802e810d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi