================================================================== BUG: KASAN: slab-use-after-free in decode_session6+0x10e1/0x1950 net/xfrm/xfrm_policy.c:3460 Read of size 1 at addr ffff888045370a47 by task syz-executor.3/18213 CPU: 0 PID: 18213 Comm: syz-executor.3 Not tainted 6.6.0-rc1-syzkaller-00160-g1612cc4b1433 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/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_send include/linux/icmpv6.h:49 [inline] ip6_link_failure+0x31/0x5a0 net/ipv6/route.c:2787 dst_link_failure include/net/dst.h:437 [inline] ip6_tnl_xmit+0x4f9/0x3900 net/ipv6/ip6_tunnel.c:1268 ipxip6_tnl_xmit net/ipv6/ip6_tunnel.c:1384 [inline] ip6_tnl_start_xmit+0x6ef/0x1750 net/ipv6/ip6_tunnel.c:1432 __netdev_start_xmit include/linux/netdevice.h:4889 [inline] netdev_start_xmit include/linux/netdevice.h:4903 [inline] xmit_one net/core/dev.c:3544 [inline] dev_hard_start_xmit+0x13d/0x6c0 net/core/dev.c:3560 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:3834 [inline] __dev_queue_xmit+0x24f9/0x3d80 net/core/dev.c:4306 dev_queue_xmit include/linux/netdevice.h:3082 [inline] neigh_connected_output+0x42c/0x5d0 net/core/neighbour.c:1581 neigh_output include/net/neighbour.h:542 [inline] ip6_finish_output2+0x610/0x1b20 net/ipv6/ip6_output.c:135 __ip6_finish_output net/ipv6/ip6_output.c:196 [inline] ip6_finish_output+0x485/0x1250 net/ipv6/ip6_output.c:207 NF_HOOK_COND include/linux/netfilter.h:293 [inline] ip6_output+0x23a/0x880 net/ipv6/ip6_output.c:228 dst_output include/net/dst.h:458 [inline] NF_HOOK include/linux/netfilter.h:304 [inline] NF_HOOK include/linux/netfilter.h:298 [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+0x1a30/0x3b30 net/ipv4/tcp_output.c:1416 tcp_transmit_skb net/ipv4/tcp_output.c:1434 [inline] tcp_send_syn_data net/ipv4/tcp_output.c:3898 [inline] tcp_connect+0x2109/0x5440 net/ipv4/tcp_output.c:3963 tcp_v6_connect+0x147f/0x1fc0 net/ipv6/tcp_ipv6.c:338 __inet_stream_connect+0x38b/0xe20 net/ipv4/af_inet.c:676 tcp_sendmsg_fastopen+0x3d2/0x700 net/ipv4/tcp.c:1021 tcp_sendmsg_locked+0x1ef0/0x3440 net/ipv4/tcp.c:1073 tcp_sendmsg+0x2e/0x40 net/ipv4/tcp.c:1336 inet6_sendmsg+0x9d/0xe0 net/ipv6/af_inet6.c:655 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:753 __sys_sendto+0x255/0x340 net/socket.c:2177 __do_sys_sendto net/socket.c:2189 [inline] __se_sys_sendto net/socket.c:2185 [inline] __x64_sys_sendto+0xe0/0x1b0 net/socket.c:2185 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f79d807cae9 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:00007f79d8e790c8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 00007f79d819bf80 RCX: 00007f79d807cae9 RDX: 0000000000000001 RSI: 00000000200000c0 RDI: 0000000000000003 RBP: 00007f79d80c847a R08: 0000000020b63fe4 R09: 000000000000001c R10: 0000000020008845 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f79d819bf80 R15: 00007ffd6f913a48 Allocated by task 5076: 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:198 [inline] __do_kmalloc_node mm/slab_common.c:1023 [inline] __kmalloc+0x60/0x100 mm/slab_common.c:1036 kmalloc include/linux/slab.h:603 [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_unlink+0x92/0xd0 security/tomoyo/tomoyo.c:161 security_path_unlink+0xf9/0x160 security/security.c:1767 do_unlinkat+0x375/0x6d0 fs/namei.c:4395 __do_sys_unlink fs/namei.c:4446 [inline] __se_sys_unlink fs/namei.c:4444 [inline] __x64_sys_unlink+0xc8/0x110 fs/namei.c:4444 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 5076: 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+0x15b/0x1b0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:164 [inline] slab_free_hook mm/slub.c:1800 [inline] slab_free_freelist_hook+0x114/0x1e0 mm/slub.c:1826 slab_free mm/slub.c:3809 [inline] __kmem_cache_free+0xb8/0x2f0 mm/slub.c:3822 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_unlink+0x92/0xd0 security/tomoyo/tomoyo.c:161 security_path_unlink+0xf9/0x160 security/security.c:1767 do_unlinkat+0x375/0x6d0 fs/namei.c:4395 __do_sys_unlink fs/namei.c:4446 [inline] __se_sys_unlink fs/namei.c:4444 [inline] __x64_sys_unlink+0xc8/0x110 fs/namei.c:4444 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372 sctp_association_destroy net/sctp/associola.c:417 [inline] sctp_association_put+0x22e/0x340 net/sctp/associola.c:869 sctp_sendmsg+0x197d/0x1e80 net/sctp/socket.c:2032 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:840 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:753 ____sys_sendmsg+0x2ac/0x940 net/socket.c:2541 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2595 __sys_sendmmsg+0x1a1/0x450 net/socket.c:2681 __do_sys_sendmmsg net/socket.c:2710 [inline] __se_sys_sendmmsg net/socket.c:2707 [inline] __x64_sys_sendmmsg+0x9c/0x100 net/socket.c:2707 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x33/0x50 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:492 kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372 sctp_association_destroy net/sctp/associola.c:417 [inline] sctp_association_put+0x22e/0x340 net/sctp/associola.c:869 sctp_cmd_delete_tcb net/sctp/sm_sideeffect.c:944 [inline] sctp_cmd_interpreter net/sctp/sm_sideeffect.c:1330 [inline] sctp_side_effects net/sctp/sm_sideeffect.c:1198 [inline] sctp_do_sm+0x2636/0x5c40 net/sctp/sm_sideeffect.c:1169 sctp_primitive_SHUTDOWN+0x9f/0xc0 net/sctp/primitive.c:89 sctp_close+0x3ed/0x940 net/sctp/socket.c:1527 inet_release+0x132/0x270 net/ipv4/af_inet.c:433 inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484 __sock_release+0xae/0x260 net/socket.c:659 sock_close+0x1c/0x20 net/socket.c:1402 __fput+0x3f7/0xa70 fs/file_table.c:384 __fput_sync+0x47/0x50 fs/file_table.c:465 __do_sys_close fs/open.c:1572 [inline] __se_sys_close fs/open.c:1557 [inline] __x64_sys_close+0x87/0xf0 fs/open.c:1557 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff888045370000 which belongs to the cache kmalloc-4k of size 4096 The buggy address is located 2631 bytes inside of freed 4096-byte region [ffff888045370000, ffff888045371000) The buggy address belongs to the physical page: page:ffffea000114dc00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x45370 head:ffffea000114dc00 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000840 ffff888012c42140 ffffea0001138400 dead000000000002 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 2179, tgid 2175 (syz-executor.5), ts 727540265422, free_ts 727516573484 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536 prep_new_page mm/page_alloc.c:1543 [inline] get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170 __alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426 alloc_pages+0x1a9/0x270 mm/mempolicy.c:2298 alloc_slab_page mm/slub.c:1870 [inline] allocate_slab+0x251/0x380 mm/slub.c:2017 new_slab mm/slub.c:2070 [inline] ___slab_alloc+0x8be/0x1570 mm/slub.c:3223 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3322 __slab_alloc_node mm/slub.c:3375 [inline] slab_alloc_node mm/slub.c:3468 [inline] __kmem_cache_alloc_node+0x137/0x350 mm/slub.c:3517 kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114 kmalloc include/linux/slab.h:599 [inline] kzalloc include/linux/slab.h:720 [inline] sctp_association_new+0x97/0x2a40 net/sctp/associola.c:291 sctp_connect_new_asoc+0x1b2/0x780 net/sctp/socket.c:1090 sctp_sendmsg_new_asoc net/sctp/socket.c:1692 [inline] sctp_sendmsg+0x15c2/0x1e80 net/sctp/socket.c:2003 inet_sendmsg+0x9d/0xe0 net/ipv4/af_inet.c:840 sock_sendmsg_nosec net/socket.c:730 [inline] sock_sendmsg+0xd9/0x180 net/socket.c:753 ____sys_sendmsg+0x2ac/0x940 net/socket.c:2541 ___sys_sendmsg+0x135/0x1d0 net/socket.c:2595 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1136 [inline] free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312 free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405 __unfreeze_partials+0x21d/0x240 mm/slub.c:2655 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:188 [inline] slab_post_alloc_hook mm/slab.h:762 [inline] slab_alloc_node mm/slub.c:3478 [inline] slab_alloc mm/slub.c:3486 [inline] __kmem_cache_alloc_lru mm/slub.c:3493 [inline] kmem_cache_alloc_lru+0x21a/0x630 mm/slub.c:3509 alloc_inode_sb include/linux/fs.h:2909 [inline] sock_alloc_inode+0x25/0x1c0 net/socket.c:308 alloc_inode+0x5d/0x220 fs/inode.c:259 new_inode_pseudo+0x16/0x80 fs/inode.c:1004 sock_alloc+0x40/0x270 net/socket.c:634 __sock_create+0xbc/0x810 net/socket.c:1516 sock_create net/socket.c:1603 [inline] __sys_socket_create net/socket.c:1640 [inline] __sys_socket+0x14c/0x260 net/socket.c:1691 __do_sys_socket net/socket.c:1705 [inline] __se_sys_socket net/socket.c:1703 [inline] __x64_sys_socket+0x72/0xb0 net/socket.c:1703 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888045370900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888045370980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888045370a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888045370a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888045370b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================