================================================================== 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 ffff888049202498 by task syz-executor/5952 CPU: 1 UID: 0 PID: 5952 Comm: syz-executor 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+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+0x371d/0x4390 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:on_stack arch/x86/include/asm/stacktrace.h:56 [inline] RIP: 0010:stack_access_ok+0x3e/0x200 arch/x86/kernel/unwind_orc.c:393 Code: 41 54 49 89 d4 4c 89 f2 55 48 c1 ea 03 48 89 f5 53 48 89 fb 48 83 ec 08 80 3c 02 00 0f 85 94 01 00 00 4c 8d 6b 10 4c 8b 7b 08 <48> b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1 ea 03 80 3c 02 00 0f RSP: 0018:ffffc900054d7508 EFLAGS: 00000246 RAX: dffffc0000000000 RBX: ffffc900054d75b8 RCX: ffffffff90ff7726 RDX: 1ffff92000a9aeb8 RSI: ffffc900054d7910 RDI: ffffc900054d75b8 RBP: ffffc900054d7910 R08: ffffffff90ff7756 R09: ffffffff90ff772a R10: ffffc900054d75b8 R11: 000000000000f165 R12: 0000000000000008 R13: ffffc900054d75c8 R14: ffffc900054d75c0 R15: ffffc900054d0000 deref_stack_reg arch/x86/kernel/unwind_orc.c:403 [inline] unwind_next_frame+0xac7/0x20c0 arch/x86/kernel/unwind_orc.c:585 arch_stack_walk+0x95/0x100 arch/x86/kernel/stacktrace.c:25 stack_trace_save+0x95/0xd0 kernel/stacktrace.c:122 kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:579 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2342 [inline] slab_free mm/slub.c:4579 [inline] kmem_cache_free+0x152/0x4b0 mm/slub.c:4681 remove_vma+0x154/0x1b0 mm/vma.c:385 exit_mmap+0x4e2/0xb30 mm/mmap.c:1691 __mmput+0x12a/0x480 kernel/fork.c:1347 mmput+0x62/0x70 kernel/fork.c:1369 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:3016 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:0x7fca44b74a53 Code: Unable to access opcode bytes at 0x7fca44b74a29. RSP: 002b:00007ffea12e5618 EFLAGS: 00000202 ORIG_RAX: 000000000000003d RAX: fffffffffffffe00 RBX: 000000000000174c RCX: 00007fca44b74a53 RDX: 0000000040000000 RSI: 00007ffea12e562c RDI: 00000000ffffffff RBP: 00007ffea12e562c R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000202 R12: 0000000000000008 R13: 0000000000000003 R14: 0000000000000009 R15: 0000000000000000 The buggy address belongs to the object at ffff888049202420 which belongs to the cache tw_sock_TCP of size 288 The buggy address is located 120 bytes inside of allocated 288-byte region [ffff888049202420, ffff888049202540) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x49202 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888031348401 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801e2c1180 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080170017 00000001f5000000 ffff888031348401 head: 00fff00000000040 ffff88801e2c1180 dead000000000122 0000000000000000 head: 0000000000000000 0000000080170017 00000001f5000000 ffff888031348401 head: 00fff00000000001 ffffea0001248081 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 5952, tgid 5952 (syz-executor), ts 155609268175, free_ts 155324395977 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_v4_do_rcv+0x1ad/0xa90 net/ipv4/tcp_ipv4.c:1939 tcp_v4_rcv+0x33a8/0x4390 net/ipv4/tcp_ipv4.c:2351 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 page last free pid 12044 tgid 12044 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:803 [inline] __mmdrop+0xd5/0x460 kernel/fork.c:919 mmdrop include/linux/sched/mm.h:55 [inline] mmdrop_sched include/linux/sched/mm.h:83 [inline] mmdrop_lazy_tlb_sched include/linux/sched/mm.h:110 [inline] finish_task_switch.isra.0+0x7af/0xcc0 kernel/sched/core.c:5268 schedule_tail+0xe/0xd0 kernel/sched/core.c:5300 ret_from_fork+0x23/0x80 arch/x86/kernel/process.c:143 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff888049202380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888049202400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888049202480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888049202500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888049202580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 41 54 push %r12 2: 49 89 d4 mov %rdx,%r12 5: 4c 89 f2 mov %r14,%rdx 8: 55 push %rbp 9: 48 c1 ea 03 shr $0x3,%rdx d: 48 89 f5 mov %rsi,%rbp 10: 53 push %rbx 11: 48 89 fb mov %rdi,%rbx 14: 48 83 ec 08 sub $0x8,%rsp 18: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 1c: 0f 85 94 01 00 00 jne 0x1b6 22: 4c 8d 6b 10 lea 0x10(%rbx),%r13 26: 4c 8b 7b 08 mov 0x8(%rbx),%r15 * 2a: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax <-- trapping instruction 31: fc ff df 34: 4c 89 ea mov %r13,%rdx 37: 48 c1 ea 03 shr $0x3,%rdx 3b: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) 3f: 0f .byte 0xf