================================================================== BUG: KASAN: slab-use-after-free in sk_msg_recvmsg+0xe3a/0xff0 net/core/skmsg.c:447 Read of size 4 at addr ffff888034f5d828 by task syz.5.1463/10798 CPU: 2 UID: 0 PID: 10798 Comm: syz.5.1463 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x156/0x4c9 mm/kasan/report.c:482 kasan_report+0xdf/0x1a0 mm/kasan/report.c:595 sk_msg_recvmsg+0xe3a/0xff0 net/core/skmsg.c:447 udp_bpf_recvmsg net/ipv4/udp_bpf.c:84 [inline] udp_bpf_recvmsg+0x2ad/0xe20 net/ipv4/udp_bpf.c:62 inet_recvmsg+0x625/0x6a0 net/ipv4/af_inet.c:891 sock_recvmsg_nosec net/socket.c:1078 [inline] sock_recvmsg+0x1b2/0x250 net/socket.c:1100 ____sys_recvmsg+0x218/0x6b0 net/socket.c:2812 ___sys_recvmsg+0x16a/0x1a0 net/socket.c:2854 do_recvmmsg+0x301/0x760 net/socket.c:2949 __sys_recvmmsg net/socket.c:3023 [inline] __do_sys_recvmmsg net/socket.c:3046 [inline] __se_sys_recvmmsg net/socket.c:3039 [inline] __x64_sys_recvmmsg+0x22a/0x280 net/socket.c:3039 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xc9/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f090f39bf79 Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f091030a028 EFLAGS: 00000246 ORIG_RAX: 000000000000012b RAX: ffffffffffffffda RBX: 00007f090f616090 RCX: 00007f090f39bf79 RDX: 0000000000000012 RSI: 0000200000000400 RDI: 0000000000000003 RBP: 00007f090f4327e0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000040000021 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f090f616128 R14: 00007f090f616090 R15: 00007ffe04774068 Allocated by task 10795: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:398 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] alloc_sk_msg+0x40/0xb0 net/core/skmsg.c:510 sk_psock_skb_ingress_self+0x2d/0x340 net/core/skmsg.c:612 sk_psock_verdict_apply net/core/skmsg.c:1038 [inline] sk_psock_verdict_recv+0xa33/0xc30 net/core/skmsg.c:1236 udp_read_skb+0x516/0x7f0 net/ipv4/udp.c:2045 sk_psock_verdict_data_ready+0x11d/0x600 net/core/skmsg.c:1257 __udp_enqueue_schedule_skb+0xb11/0x1080 net/ipv4/udp.c:1789 __udp_queue_rcv_skb net/ipv4/udp.c:2346 [inline] udp_queue_rcv_one_skb+0x961/0x17f0 net/ipv4/udp.c:2475 udp_queue_rcv_skb+0x19c/0xe20 net/ipv4/udp.c:2493 __udp4_lib_mcast_deliver net/ipv4/udp.c:2585 [inline] __udp4_lib_rcv+0x2561/0x3500 net/ipv4/udp.c:2724 ip_protocol_deliver_rcu+0x304/0x4d0 net/ipv4/ip_input.c:207 ip_local_deliver_finish+0x3f2/0x6e0 net/ipv4/ip_input.c:241 NF_HOOK include/linux/netfilter.h:318 [inline] NF_HOOK include/linux/netfilter.h:312 [inline] ip_local_deliver+0x19a/0x1f0 net/ipv4/ip_input.c:262 dst_input include/net/dst.h:474 [inline] ip_sublist_rcv_finish net/ipv4/ip_input.c:584 [inline] ip_list_rcv_finish+0xca1/0x1240 net/ipv4/ip_input.c:628 ip_sublist_rcv net/ipv4/ip_input.c:644 [inline] ip_list_rcv+0x338/0x450 net/ipv4/ip_input.c:678 __netif_receive_skb_list_ptype net/core/dev.c:6195 [inline] __netif_receive_skb_list_core+0x74c/0x940 net/core/dev.c:6242 __netif_receive_skb_list net/core/dev.c:6294 [inline] netif_receive_skb_list_internal+0x722/0xd40 net/core/dev.c:6385 netif_receive_skb_list net/core/dev.c:6437 [inline] netif_receive_skb_list+0x4f/0x450 net/core/dev.c:6427 xdp_recv_frames net/bpf/test_run.c:269 [inline] xdp_test_run_batch.constprop.0+0x16b6/0x1ca0 net/bpf/test_run.c:350 bpf_test_run_xdp_live+0x367/0x760 net/bpf/test_run.c:379 bpf_prog_test_run_xdp+0xd7d/0x1670 net/bpf/test_run.c:1396 bpf_prog_test_run kernel/bpf/syscall.c:4703 [inline] __sys_bpf+0x1e56/0x5050 kernel/bpf/syscall.c:6182 __do_sys_bpf kernel/bpf/syscall.c:6274 [inline] __se_sys_bpf kernel/bpf/syscall.c:6272 [inline] __x64_sys_bpf+0x7b/0xc0 kernel/bpf/syscall.c:6272 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xc9/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 10803: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:253 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6674 [inline] kfree+0x1c7/0x690 mm/slub.c:6886 kfree_sk_msg include/linux/skmsg.h:385 [inline] sk_msg_recvmsg+0xc3c/0xff0 net/core/skmsg.c:483 udp_bpf_recvmsg net/ipv4/udp_bpf.c:84 [inline] udp_bpf_recvmsg+0x2ad/0xe20 net/ipv4/udp_bpf.c:62 inet_recvmsg+0x625/0x6a0 net/ipv4/af_inet.c:891 sock_recvmsg_nosec net/socket.c:1078 [inline] sock_recvmsg+0x1b2/0x250 net/socket.c:1100 ____sys_recvmsg+0x218/0x6b0 net/socket.c:2812 ___sys_recvmsg+0x16a/0x1a0 net/socket.c:2854 do_recvmmsg+0x301/0x760 net/socket.c:2949 __sys_recvmmsg net/socket.c:3023 [inline] __do_sys_recvmmsg net/socket.c:3046 [inline] __se_sys_recvmmsg net/socket.c:3039 [inline] __x64_sys_recvmmsg+0x22a/0x280 net/socket.c:3039 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xc9/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888034f5d800 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 40 bytes inside of freed 1024-byte region [ffff888034f5d800, ffff888034f5dc00) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x34f58 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b842dc0 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b842dc0 0000000000000000 dead000000000001 head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0000d3d601 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6307, tgid 6307 (syz-executor), ts 71299538978, free_ts 70766402298 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1e1/0x250 mm/page_alloc.c:1884 prep_new_page mm/page_alloc.c:1892 [inline] get_page_from_freelist+0xe3d/0x2e10 mm/page_alloc.c:3945 __alloc_frozen_pages_noprof+0x26c/0x2410 mm/page_alloc.c:5240 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab mm/slub.c:3248 [inline] new_slab+0x2c4/0x440 mm/slub.c:3302 ___slab_alloc+0xda3/0x1ca0 mm/slub.c:4656 __slab_alloc.isra.0+0x63/0x110 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __do_kmalloc_node mm/slub.c:5656 [inline] __kmalloc_node_noprof+0x62b/0x9e0 mm/slub.c:5663 kmalloc_node_noprof include/linux/slab.h:987 [inline] qdisc_alloc+0xb7/0xa30 net/sched/sch_generic.c:951 qdisc_create_dflt+0x93/0x460 net/sched/sch_generic.c:1008 attach_one_default_qdisc net/sched/sch_generic.c:1174 [inline] netdev_for_each_tx_queue include/linux/netdevice.h:2680 [inline] attach_default_qdiscs net/sched/sch_generic.c:1192 [inline] dev_activate+0x64f/0xce0 net/sched/sch_generic.c:1251 __dev_open+0x4f1/0x960 net/core/dev.c:1705 __dev_change_flags+0x558/0x6f0 net/core/dev.c:9749 netif_change_flags+0x8d/0x160 net/core/dev.c:9812 do_setlink.isra.0+0x1abb/0x3e50 net/core/rtnetlink.c:3158 rtnl_changelink net/core/rtnetlink.c:3776 [inline] __rtnl_newlink net/core/rtnetlink.c:3935 [inline] rtnl_newlink+0x11bd/0x2380 net/core/rtnetlink.c:4072 page last free pid 6304 tgid 6303 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1433 [inline] __free_frozen_pages+0x822/0x1130 mm/page_alloc.c:2973 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xe0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:350 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4953 [inline] slab_alloc_node mm/slub.c:5263 [inline] __do_kmalloc_node mm/slub.c:5656 [inline] __kmalloc_noprof+0x300/0x9c0 mm/slub.c:5669 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] copy_splice_read+0x1a3/0xb90 fs/splice.c:337 do_splice_read fs/splice.c:982 [inline] do_splice_read+0x285/0x370 fs/splice.c:956 splice_direct_to_actor+0x2a1/0xa30 fs/splice.c:1086 do_splice_direct_actor fs/splice.c:1204 [inline] do_splice_direct+0x174/0x240 fs/splice.c:1230 do_sendfile+0xadc/0xe20 fs/read_write.c:1372 __do_sys_sendfile64 fs/read_write.c:1433 [inline] __se_sys_sendfile64 fs/read_write.c:1419 [inline] __x64_sys_sendfile64+0x1d8/0x220 fs/read_write.c:1419 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xc9/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888034f5d700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888034f5d780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888034f5d800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888034f5d880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888034f5d900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================