================================================================== BUG: KASAN: slab-out-of-bounds in selinux_sock security/selinux/include/objsec.h:207 [inline] BUG: KASAN: slab-out-of-bounds in selinux_ip_output+0x1e0/0x1f0 security/selinux/hooks.c:5761 Read of size 8 at addr ffff88805e5ca498 by task syz.5.1477/11861 CPU: 3 UID: 0 PID: 11861 Comm: syz.5.1477 Not tainted 6.12.0-syzkaller-09073-g9f16d5e6f220 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 selinux_sock security/selinux/include/objsec.h:207 [inline] selinux_ip_output+0x1e0/0x1f0 security/selinux/hooks.c:5761 nf_hook_entry_hookfn include/linux/netfilter.h:154 [inline] nf_hook_slow+0xbb/0x200 net/netfilter/core.c:626 nf_hook+0x474/0x7d0 include/linux/netfilter.h:269 NF_HOOK include/linux/netfilter.h:312 [inline] ip6_xmit+0xd44/0x2130 net/ipv6/ip6_output.c:366 tcp_v6_send_response+0x11d9/0x25e0 net/ipv6/tcp_ipv6.c:999 tcp_v6_send_ack net/ipv6/tcp_ipv6.c:1152 [inline] tcp_v6_timewait_ack net/ipv6/tcp_ipv6.c:1199 [inline] tcp_v6_rcv+0x2c9c/0x3fd0 net/ipv6/tcp_ipv6.c:1993 ip6_protocol_deliver_rcu+0x180/0x1510 net/ipv6/ip6_input.c:436 ip6_input_finish+0x14f/0x2f0 net/ipv6/ip6_input.c:481 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip6_input+0xa1/0xd0 net/ipv6/ip6_input.c:490 dst_input include/net/dst.h:460 [inline] ip6_rcv_finish net/ipv6/ip6_input.c:79 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ipv6_rcv+0x265/0x680 net/ipv6/ip6_input.c:309 __netif_receive_skb_one_core+0x12e/0x1e0 net/core/dev.c:5672 __netif_receive_skb+0x1d/0x160 net/core/dev.c:5785 process_backlog+0x443/0x15f0 net/core/dev.c:6117 __napi_poll.constprop.0+0xb7/0x550 net/core/dev.c:6877 napi_poll net/core/dev.c:6946 [inline] net_rx_action+0xa94/0x1010 net/core/dev.c:7068 handle_softirqs+0x213/0x8f0 kernel/softirq.c:554 do_softirq kernel/softirq.c:455 [inline] do_softirq+0xb2/0xf0 kernel/softirq.c:442 __local_bh_enable_ip+0x100/0x120 kernel/softirq.c:382 local_bh_enable include/linux/bottom_half.h:33 [inline] rcu_read_unlock_bh include/linux/rcupdate.h:919 [inline] __dev_queue_xmit+0x8b0/0x43e0 net/core/dev.c:4461 dev_queue_xmit include/linux/netdevice.h:3168 [inline] neigh_hh_output include/net/neighbour.h:523 [inline] neigh_output include/net/neighbour.h:537 [inline] ip6_finish_output2+0x1801/0x2070 net/ipv6/ip6_output.c:141 __ip6_finish_output net/ipv6/ip6_output.c:215 [inline] ip6_finish_output+0x3f9/0x1360 net/ipv6/ip6_output.c:226 NF_HOOK_COND include/linux/netfilter.h:303 [inline] ip6_output+0x1f8/0x540 net/ipv6/ip6_output.c:247 dst_output include/net/dst.h:450 [inline] NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip6_xmit+0x1234/0x2130 net/ipv6/ip6_output.c:366 inet6_csk_xmit+0x3ce/0x740 net/ipv6/inet6_connection_sock.c:135 __tcp_transmit_skb+0x1b02/0x3df0 net/ipv4/tcp_output.c:1466 tcp_transmit_skb net/ipv4/tcp_output.c:1484 [inline] tcp_write_xmit+0x12b1/0x8560 net/ipv4/tcp_output.c:2827 __tcp_push_pending_frames+0xaf/0x390 net/ipv4/tcp_output.c:3010 tcp_send_fin+0x154/0xc70 net/ipv4/tcp_output.c:3616 tcp_shutdown net/ipv4/tcp.c:2994 [inline] tcp_shutdown+0x12b/0x170 net/ipv4/tcp.c:2979 mptcp_subflow_shutdown+0x1c3/0x380 net/mptcp/protocol.c:2928 mptcp_check_send_data_fin+0x24a/0x450 net/mptcp/protocol.c:3018 __mptcp_close+0x8cb/0xb90 net/mptcp/protocol.c:3114 mptcp_close+0x28/0xe0 net/mptcp/protocol.c:3168 inet_release+0x13c/0x280 net/ipv4/af_inet.c:435 inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:487 __sock_release+0xb0/0x270 net/socket.c:640 sock_close+0x1c/0x30 net/socket.c:1408 __fput+0x3f8/0xb60 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:239 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fbd8eb7e819 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007fff39d9eb08 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4 RAX: 0000000000000000 RBX: 00007fbd8ed37ba0 RCX: 00007fbd8eb7e819 RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003 RBP: 00007fbd8ed37ba0 R08: 00000000000001b0 R09: 00007fff39d9edff R10: 00000000003ffc30 R11: 0000000000000246 R12: 0000000000026a95 R13: 00007fff39d9ec10 R14: 0000000000000032 R15: ffffffffffffffff The buggy address belongs to the object at ffff88805e5ca420 which belongs to the cache tw_sock_TCPv6 of size 288 The buggy address is located 120 bytes inside of allocated 288-byte region [ffff88805e5ca420, ffff88805e5ca540) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5e5ca head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888027124d01 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff888100092b40 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080170017 00000001f5000000 ffff888027124d01 head: 00fff00000000040 ffff888100092b40 dead000000000122 0000000000000000 head: 0000000000000000 0000000080170017 00000001f5000000 ffff888027124d01 head: 00fff00000000001 ffffea0001797281 ffffffffffffffff 0000000000000000 head: 0000000000000002 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x52820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 34, tgid 34 (ksoftirqd/3), ts 155406509353, free_ts 155303506267 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3474 __alloc_pages_noprof+0x223/0x25a0 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2412 [inline] allocate_slab mm/slub.c:2578 [inline] new_slab+0x2c9/0x410 mm/slub.c:2631 ___slab_alloc+0xdac/0x1880 mm/slub.c:3818 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3908 __slab_alloc_node mm/slub.c:3961 [inline] slab_alloc_node mm/slub.c:4122 [inline] kmem_cache_alloc_noprof+0x2a7/0x2f0 mm/slub.c:4141 inet_twsk_alloc+0x120/0x970 net/ipv4/inet_timewait_sock.c:188 tcp_time_wait+0x5f/0xe10 net/ipv4/tcp_minisocks.c:309 tcp_rcv_state_process+0x4935/0x4c40 net/ipv4/tcp_input.c:6917 tcp_v6_do_rcv+0x492/0x1730 net/ipv6/tcp_ipv6.c:1667 tcp_v6_rcv+0x30b3/0x3fd0 net/ipv6/tcp_ipv6.c:1914 ip6_protocol_deliver_rcu+0x180/0x1510 net/ipv6/ip6_input.c:436 ip6_input_finish+0x14f/0x2f0 net/ipv6/ip6_input.c:481 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip6_input+0xa1/0xd0 net/ipv6/ip6_input.c:490 page last free pid 11888 tgid 11887 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0x661/0x1080 mm/page_alloc.c:2657 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x4e/0x120 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x195/0x1e0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4085 [inline] slab_alloc_node mm/slub.c:4134 [inline] __kmalloc_cache_noprof+0x11e/0x300 mm/slub.c:4290 kmalloc_noprof include/linux/slab.h:879 [inline] kzalloc_noprof include/linux/slab.h:1015 [inline] ref_tracker_alloc+0x17c/0x5b0 lib/ref_tracker.c:203 __netdev_tracker_alloc include/linux/netdevice.h:4136 [inline] netdev_hold include/linux/netdevice.h:4165 [inline] netdev_hold include/linux/netdevice.h:4160 [inline] rx_queue_add_kobject net/core/net-sysfs.c:1106 [inline] net_rx_queue_update_kobjects+0x284/0x5f0 net/core/net-sysfs.c:1164 register_queue_kobjects net/core/net-sysfs.c:1898 [inline] netdev_register_kobject+0x26d/0x3f0 net/core/net-sysfs.c:2143 register_netdevice+0x1473/0x1e90 net/core/dev.c:10593 veth_newlink+0x436/0xa30 drivers/net/veth.c:1850 rtnl_newlink_create net/core/rtnetlink.c:3774 [inline] __rtnl_newlink net/core/rtnetlink.c:3891 [inline] rtnl_newlink+0xb88/0x1c50 net/core/rtnetlink.c:4001 rtnetlink_rcv_msg+0x95b/0xea0 net/core/rtnetlink.c:6911 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2541 netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1347 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1891 sock_sendmsg_nosec net/socket.c:711 [inline] __sock_sendmsg net/socket.c:726 [inline] ____sys_sendmsg+0xaaf/0xc90 net/socket.c:2583 Memory state around the buggy address: ffff88805e5ca380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805e5ca400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88805e5ca480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88805e5ca500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805e5ca580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================