================================================================== 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 ffff8880548a6498 by task syz.7.449/8341 CPU: 1 UID: 0 PID: 8341 Comm: syz.7.449 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:fast_imageblit drivers/video/fbdev/core/sysimgblt.c:264 [inline] RIP: 0010:sys_imageblit+0x1991/0x21d0 drivers/video/fbdev/core/sysimgblt.c:326 Code: 42 0f b6 14 30 48 89 f8 83 e0 07 83 c0 03 38 d0 7c 08 84 d2 0f 85 4a 04 00 00 89 4d 18 41 0f b6 45 00 44 21 f8 3c 0f 0f b6 d0 <0f> 87 44 04 00 00 49 8d 3c 94 48 83 c5 20 48 89 f8 48 c1 e8 03 42 RSP: 0018:ffffc900036ef4a8 EFLAGS: 00000293 RAX: 0000000000000001 RBX: 00000000000002d8 RCX: 0000000000000000 RDX: 0000000000000001 RSI: ffffffff84dd88b1 RDI: ffffc900054a44b8 RBP: ffffc900054a44a0 R08: 0000000000000005 R09: 0000000000000007 R10: 00000000000002d8 R11: 0000000000000005 R12: ffffc900036ef580 R13: ffff888106694b85 R14: dffffc0000000000 R15: 0000000000000001 drm_fbdev_shmem_defio_imageblit+0x20/0x130 drivers/gpu/drm/drm_fbdev_shmem.c:37 bit_putcs_unaligned drivers/video/fbdev/core/bitblit.c:139 [inline] bit_putcs+0x90e/0xdf0 drivers/video/fbdev/core/bitblit.c:188 fbcon_putcs+0x364/0x480 drivers/video/fbdev/core/fbcon.c:1308 do_update_region+0x2e6/0x3f0 drivers/tty/vt/vt.c:619 csi_J+0x542/0xad0 drivers/tty/vt/vt.c:1528 reset_terminal+0x650/0x770 drivers/tty/vt/vt.c:2183 handle_esc drivers/tty/vt/vt.c:2366 [inline] do_con_trol drivers/tty/vt/vt.c:2573 [inline] do_con_write+0x2ac0/0x7bb0 drivers/tty/vt/vt.c:3092 con_write+0x23/0xb0 drivers/tty/vt/vt.c:3434 process_output_block drivers/tty/n_tty.c:574 [inline] n_tty_write+0x419/0x1140 drivers/tty/n_tty.c:2389 iterate_tty_write drivers/tty/tty_io.c:1015 [inline] file_tty_write.constprop.0+0x506/0x9a0 drivers/tty/tty_io.c:1090 new_sync_write fs/read_write.c:586 [inline] vfs_write+0x5ae/0x1150 fs/read_write.c:679 ksys_write+0x12b/0x250 fs/read_write.c:731 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7faacc97e819 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:00007faacc7f9038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007faaccb35fa0 RCX: 00007faacc97e819 RDX: 0000000000001006 RSI: 0000000020001040 RDI: 0000000000000006 RBP: 00007faacc9f175e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007faaccb35fa0 R15: 00007ffc978af7d8 The buggy address belongs to the object at ffff8880548a6420 which belongs to the cache tw_sock_TCP of size 288 The buggy address is located 120 bytes inside of allocated 288-byte region [ffff8880548a6420, ffff8880548a6540) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x548a6 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88804a25d001 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff888020593180 dead000000000122 0000000000000000 raw: 0000000000000000 0000000080170017 00000001f5000000 ffff88804a25d001 head: 00fff00000000040 ffff888020593180 dead000000000122 0000000000000000 head: 0000000000000000 0000000080170017 00000001f5000000 ffff88804a25d001 head: 00fff00000000001 ffffea0001522981 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 8341, tgid 8339 (syz.7.449), ts 121378165426, free_ts 121373282234 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 8308 tgid 8308 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] __mmput+0x3c8/0x480 kernel/fork.c:1358 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 Memory state around the buggy address: ffff8880548a6380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880548a6400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8880548a6480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8880548a6500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8880548a6580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 42 0f b6 14 30 movzbl (%rax,%r14,1),%edx 5: 48 89 f8 mov %rdi,%rax 8: 83 e0 07 and $0x7,%eax b: 83 c0 03 add $0x3,%eax e: 38 d0 cmp %dl,%al 10: 7c 08 jl 0x1a 12: 84 d2 test %dl,%dl 14: 0f 85 4a 04 00 00 jne 0x464 1a: 89 4d 18 mov %ecx,0x18(%rbp) 1d: 41 0f b6 45 00 movzbl 0x0(%r13),%eax 22: 44 21 f8 and %r15d,%eax 25: 3c 0f cmp $0xf,%al 27: 0f b6 d0 movzbl %al,%edx * 2a: 0f 87 44 04 00 00 ja 0x474 <-- trapping instruction 30: 49 8d 3c 94 lea (%r12,%rdx,4),%rdi 34: 48 83 c5 20 add $0x20,%rbp 38: 48 89 f8 mov %rdi,%rax 3b: 48 c1 e8 03 shr $0x3,%rax 3f: 42 rex.X