================================================================== BUG: KASAN: use-after-free in skb_frag_size include/linux/skbuff.h:330 [inline] BUG: KASAN: use-after-free in __skb_datagram_iter+0x6b8/0x770 net/core/datagram.c:441 Read of size 4 at addr ffff888032f90004 by task syz-fuzzer/8440 CPU: 0 PID: 8440 Comm: syz-fuzzer Not tainted 5.12.0-rc8-next-20210423-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_address_description.constprop.0.cold+0x5b/0x2f8 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x7c/0xd8 mm/kasan/report.c:436 skb_frag_size include/linux/skbuff.h:330 [inline] __skb_datagram_iter+0x6b8/0x770 net/core/datagram.c:441 skb_copy_datagram_iter+0x40/0x50 net/core/datagram.c:533 skb_copy_datagram_msg include/linux/skbuff.h:3602 [inline] tcp_recvmsg_locked+0x1048/0x22f0 net/ipv4/tcp.c:2472 tcp_recvmsg+0x134/0x550 net/ipv4/tcp.c:2550 inet_recvmsg+0x11b/0x5e0 net/ipv4/af_inet.c:852 sock_recvmsg_nosec net/socket.c:888 [inline] sock_recvmsg net/socket.c:906 [inline] sock_recvmsg net/socket.c:902 [inline] sock_read_iter+0x33c/0x470 net/socket.c:979 call_read_iter include/linux/fs.h:2108 [inline] new_sync_read+0x5b7/0x6e0 fs/read_write.c:415 vfs_read+0x35c/0x570 fs/read_write.c:496 ksys_read+0x1ee/0x250 fs/read_write.c:634 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x4af19b Code: fb ff eb bd e8 a6 b6 fb ff e9 61 ff ff ff cc e8 9b 82 fb ff 48 8b 7c 24 10 48 8b 74 24 18 48 8b 54 24 20 48 8b 44 24 08 0f 05 <48> 3d 01 f0 ff ff 76 20 48 c7 44 24 28 ff ff ff ff 48 c7 44 24 30 RSP: 002b:000000c00064b828 EFLAGS: 00000212 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000000c00001c000 RCX: 00000000004af19b RDX: 0000000000001000 RSI: 000000c0004a5000 RDI: 0000000000000006 RBP: 000000c00064b878 R08: 0000000000000001 R09: 0000000000000002 R10: 000000000000001d R11: 0000000000000212 R12: 0000000000b97a20 R13: ffffffffffffffff R14: 0000000000000020 R15: 0000000000000020 Allocated by task 0: (stack is not available) Freed by task 8440: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:357 ____kasan_slab_free mm/kasan/common.c:360 [inline] ____kasan_slab_free mm/kasan/common.c:325 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:212 [inline] slab_free_hook mm/slub.c:1593 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1618 slab_free mm/slub.c:3178 [inline] kfree+0xe5/0x7f0 mm/slub.c:4245 skb_free_head net/core/skbuff.c:651 [inline] skb_release_data+0x622/0x750 net/core/skbuff.c:672 skb_release_all net/core/skbuff.c:726 [inline] __kfree_skb net/core/skbuff.c:740 [inline] consume_skb net/core/skbuff.c:896 [inline] consume_skb+0xc2/0x160 net/core/skbuff.c:890 __dev_kfree_skb_any+0x6b/0x80 net/core/dev.c:3194 dev_consume_skb_any include/linux/netdevice.h:3984 [inline] napi_consume_skb+0x27b/0x340 net/core/skbuff.c:951 free_old_xmit_skbs+0xe4/0x270 drivers/net/virtio_net.c:1457 start_xmit+0x144/0x16c0 drivers/net/virtio_net.c:1677 __netdev_start_xmit include/linux/netdevice.h:4944 [inline] netdev_start_xmit include/linux/netdevice.h:4958 [inline] xmit_one net/core/dev.c:3654 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3670 sch_direct_xmit+0x2e1/0xbd0 net/sched/sch_generic.c:313 qdisc_restart net/sched/sch_generic.c:376 [inline] __qdisc_run+0x4ba/0x15f0 net/sched/sch_generic.c:384 qdisc_run include/net/pkt_sched.h:136 [inline] qdisc_run include/net/pkt_sched.h:128 [inline] __dev_xmit_skb net/core/dev.c:3856 [inline] __dev_queue_xmit+0x1390/0x2e50 net/core/dev.c:4213 neigh_hh_output include/net/neighbour.h:499 [inline] neigh_output include/net/neighbour.h:508 [inline] ip_finish_output2+0xef0/0x2220 net/ipv4/ip_output.c:230 __ip_finish_output net/ipv4/ip_output.c:308 [inline] __ip_finish_output+0x396/0x640 net/ipv4/ip_output.c:290 ip_finish_output+0x35/0x200 net/ipv4/ip_output.c:318 NF_HOOK_COND include/linux/netfilter.h:290 [inline] ip_output+0x196/0x310 net/ipv4/ip_output.c:432 dst_output include/net/dst.h:448 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] __ip_queue_xmit+0x8d3/0x1a30 net/ipv4/ip_output.c:533 __tcp_transmit_skb+0x1889/0x38f0 net/ipv4/tcp_output.c:1405 __tcp_send_ack.part.0+0x3d6/0x7a0 net/ipv4/tcp_output.c:3970 __tcp_send_ack net/ipv4/tcp_output.c:3976 [inline] tcp_send_ack+0x7d/0xa0 net/ipv4/tcp_output.c:3976 tcp_cleanup_rbuf+0x46c/0x5b0 net/ipv4/tcp.c:1598 tcp_recvmsg_locked+0x7aa/0x22f0 net/ipv4/tcp.c:2520 tcp_recvmsg+0x134/0x550 net/ipv4/tcp.c:2550 inet_recvmsg+0x11b/0x5e0 net/ipv4/af_inet.c:852 sock_recvmsg_nosec net/socket.c:888 [inline] sock_recvmsg net/socket.c:906 [inline] sock_recvmsg net/socket.c:902 [inline] sock_read_iter+0x33c/0x470 net/socket.c:979 call_read_iter include/linux/fs.h:2108 [inline] new_sync_read+0x5b7/0x6e0 fs/read_write.c:415 vfs_read+0x35c/0x570 fs/read_write.c:496 ksys_read+0x1ee/0x250 fs/read_write.c:634 do_syscall_64+0x3a/0xb0 arch/x86/entry/common.c:47 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888032f90000 which belongs to the cache kmalloc-1k of size 1024 The buggy address is located 4 bytes inside of 1024-byte region [ffff888032f90000, ffff888032f90400) The buggy address belongs to the page: page:ffffea0000cbe400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x32f90 head:ffffea0000cbe400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888011041dc0 raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888032f8ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888032f8ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888032f90000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888032f90080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888032f90100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================