================================================================== 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 ffff888032eda758 by task syz-executor/9217 CPU: 1 UID: 0 PID: 9217 Comm: syz-executor Not tainted 6.13.0-rc1-syzkaller-00025-gfeffde684ac2 #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+0x386/0x6d0 include/linux/netfilter.h:269 __ip_local_out+0x339/0x640 net/ipv4/ip_output.c:119 ip_local_out net/ipv4/ip_output.c:128 [inline] ip_send_skb net/ipv4/ip_output.c:1505 [inline] ip_push_pending_frames+0xa0/0x5b0 net/ipv4/ip_output.c:1525 ip_send_unicast_reply+0xd0e/0x1650 net/ipv4/ip_output.c:1672 tcp_v4_send_reset+0x129b/0x2f20 net/ipv4/tcp_ipv4.c:910 tcp_v4_rcv+0x3715/0x4380 net/ipv4/tcp_ipv4.c:2431 ip_protocol_deliver_rcu+0xba/0x4c0 net/ipv4/ip_input.c:205 ip_local_deliver_finish+0x316/0x570 net/ipv4/ip_input.c:233 NF_HOOK include/linux/netfilter.h:314 [inline] NF_HOOK include/linux/netfilter.h:308 [inline] ip_local_deliver+0x18e/0x1f0 net/ipv4/ip_input.c:254 dst_input include/net/dst.h:460 [inline] ip_sublist_rcv_finish+0x2c1/0x620 net/ipv4/ip_input.c:578 ip_list_rcv_finish.constprop.0+0x559/0x720 net/ipv4/ip_input.c:628 ip_sublist_rcv net/ipv4/ip_input.c:636 [inline] ip_list_rcv+0x339/0x450 net/ipv4/ip_input.c:670 __netif_receive_skb_list_ptype net/core/dev.c:5715 [inline] __netif_receive_skb_list_core+0x755/0x950 net/core/dev.c:5762 __netif_receive_skb_list net/core/dev.c:5814 [inline] netif_receive_skb_list_internal+0x753/0xdb0 net/core/dev.c:5905 gro_normal_list include/net/gro.h:515 [inline] gro_normal_list include/net/gro.h:511 [inline] napi_complete_done+0x218/0x940 net/core/dev.c:6256 e1000_clean+0xa28/0x2700 drivers/net/ethernet/intel/e1000/e1000_main.c:3815 __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:588 [inline] invoke_softirq kernel/softirq.c:428 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:655 irq_exit_rcu+0x9/0x30 kernel/softirq.c:671 common_interrupt+0xbf/0xe0 arch/x86/kernel/irq.c:278 asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:693 RIP: 0010:__debug_check_no_obj_freed lib/debugobjects.c:1088 [inline] RIP: 0010:debug_check_no_obj_freed+0x1c5/0x600 lib/debugobjects.c:1129 Code: 24 58 4b 8d 04 2c 4c 89 64 24 28 48 8d 34 c5 c0 f0 9c 9a 4c 89 6c 24 30 48 89 f0 49 89 f4 48 c1 e8 03 48 01 d8 48 89 44 24 40 <48> 8b 7c 24 58 e8 11 e4 85 06 48 89 44 24 48 48 8b 44 24 40 80 38 RSP: 0018:ffffc90003bdf8b0 EFLAGS: 00000286 RAX: fffffbfff3545ed2 RBX: dffffc0000000000 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff9aa2f690 RDI: 0000000000000001 RBP: ffffc90003bdf9f0 R08: 0000000000000001 R09: 000000000000ab50 R10: ffffffff905f0417 R11: 0000000000000000 R12: ffffffff9aa2f690 R13: 000000000000156a R14: 0000000000000002 R15: ffffc90033a46000 remove_vm_area+0x1ae/0x3f0 mm/vmalloc.c:3241 vfree+0x90/0x890 mm/vmalloc.c:3364 kcov_put kernel/kcov.c:439 [inline] kcov_put+0x2a/0x40 kernel/kcov.c:435 kcov_close+0xd/0x20 kernel/kcov.c:535 __fput+0x3f8/0xb60 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:239 exit_task_work include/linux/task_work.h:43 [inline] do_exit+0xadd/0x2d70 kernel/exit.c:938 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087 get_signal+0x24ed/0x26c0 kernel/signal.c:3017 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0x150/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:0x7fa25c5b27c5 Code: Unable to access opcode bytes at 0x7fa25c5b279b. RSP: 002b:00007ffe0b061720 EFLAGS: 00000293 ORIG_RAX: 00000000000000e6 RAX: 0000000000000000 RBX: 00000000000002b4 RCX: 00007fa25c5b27c5 RDX: 00007ffe0b061760 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 00007ffe0b0617bc R08: 0000000000000000 R09: 00007fa25d351000 R10: 0000000000000000 R11: 0000000000000293 R12: 0000000000000032 R13: 0000000000030d48 R14: 0000000000030d0b R15: 00007ffe0b061810 The buggy address belongs to the object at ffff888032eda6e0 which belongs to the cache tw_sock_TCP of size 288 The buggy address is located 120 bytes inside of allocated 288-byte region [ffff888032eda6e0, ffff888032eda800) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888032eda160 pfn:0x32eda head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888024bfa901 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801ca8f680 dead000000000122 0000000000000000 raw: ffff888032eda160 0000000080170015 00000001f5000000 ffff888024bfa901 head: 00fff00000000040 ffff88801ca8f680 dead000000000122 0000000000000000 head: ffff888032eda160 0000000080170015 00000001f5000000 ffff888024bfa901 head: 00fff00000000001 ffffea0000cbb681 ffffffffffffffff 0000000000000000 head: ffff888000000002 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 8042, tgid 8042 (syz.3.693), ts 95888117108, free_ts 95872462033 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/0x25b0 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0x2c9/0x610 mm/mempolicy.c:2265 alloc_slab_page mm/slub.c:2408 [inline] allocate_slab mm/slub.c:2574 [inline] new_slab+0x2c9/0x410 mm/slub.c:2627 ___slab_alloc+0xdac/0x1870 mm/slub.c:3815 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3905 __slab_alloc_node mm/slub.c:3980 [inline] slab_alloc_node mm/slub.c:4141 [inline] kmem_cache_alloc_noprof+0xfa/0x3d0 mm/slub.c:4160 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+0x1fda/0x4c40 net/ipv4/tcp_input.c:6925 tcp_v4_do_rcv+0x1ad/0xa90 net/ipv4/tcp_ipv4.c:1939 sk_backlog_rcv include/net/sock.h:1121 [inline] __release_sock+0x31b/0x400 net/core/sock.c:3083 __tcp_close+0x4f3/0xff0 net/ipv4/tcp.c:3143 tcp_close+0x28/0x120 net/ipv4/tcp.c:3221 inet_release+0x13c/0x280 net/ipv4/af_inet.c:435 page last free pid 8043 tgid 8040 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 mm_free_pgd kernel/fork.c:809 [inline] __mmdrop+0xd5/0x460 kernel/fork.c:925 mmdrop include/linux/sched/mm.h:55 [inline] __mmput+0x404/0x4c0 kernel/fork.c:1364 mmput+0x62/0x70 kernel/fork.c:1375 exit_mm kernel/exit.c:570 [inline] do_exit+0x9bf/0x2d70 kernel/exit.c:925 do_group_exit+0xd3/0x2a0 kernel/exit.c:1087 get_signal+0x24ed/0x26c0 kernel/signal.c:3017 arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [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+0x150/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888032eda600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888032eda680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888032eda700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888032eda780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888032eda800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 24 58 and $0x58,%al 2: 4b 8d 04 2c lea (%r12,%r13,1),%rax 6: 4c 89 64 24 28 mov %r12,0x28(%rsp) b: 48 8d 34 c5 c0 f0 9c lea -0x65630f40(,%rax,8),%rsi 12: 9a 13: 4c 89 6c 24 30 mov %r13,0x30(%rsp) 18: 48 89 f0 mov %rsi,%rax 1b: 49 89 f4 mov %rsi,%r12 1e: 48 c1 e8 03 shr $0x3,%rax 22: 48 01 d8 add %rbx,%rax 25: 48 89 44 24 40 mov %rax,0x40(%rsp) * 2a: 48 8b 7c 24 58 mov 0x58(%rsp),%rdi <-- trapping instruction 2f: e8 11 e4 85 06 call 0x685e445 34: 48 89 44 24 48 mov %rax,0x48(%rsp) 39: 48 8b 44 24 40 mov 0x40(%rsp),%rax 3e: 80 .byte 0x80 3f: 38 .byte 0x38