syzbot


KASAN: use-after-free Read in ip_dst_mtu_maybe_forward

Status: closed as invalid on 2025/02/10 17:36
Subsystems: net
[Documentation on labels]
First crash: 214d, last: 214d

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in read_pnet include/net/net_namespace.h:395 [inline]
BUG: KASAN: use-after-free in dev_net include/linux/netdevice.h:2663 [inline]
BUG: KASAN: use-after-free in ip_dst_mtu_maybe_forward.constprop.0+0x466/0x4c0 include/net/ip.h:474
Read of size 8 at addr ffff88805da38108 by task syz.1.26/5992

CPU: 0 UID: 0 PID: 5992 Comm: syz.1.26 Not tainted 6.13.0-syzkaller-05001-gd0d106a2bd21 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
 <TASK>
 __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
 read_pnet include/net/net_namespace.h:395 [inline]
 dev_net include/linux/netdevice.h:2663 [inline]
 ip_dst_mtu_maybe_forward.constprop.0+0x466/0x4c0 include/net/ip.h:474
 dst_mtu include/net/dst.h:216 [inline]
 ip_setup_cork+0x921/0xad0 net/ipv4/ip_output.c:1297
 ip_make_skb+0x1bf/0x300 net/ipv4/ip_output.c:1564
 udp_sendmsg+0x18c7/0x2a30 net/ipv4/udp.c:1479
 inet_sendmsg+0x105/0x140 net/ipv4/af_inet.c:851
 sock_sendmsg_nosec net/socket.c:713 [inline]
 __sock_sendmsg net/socket.c:728 [inline]
 ____sys_sendmsg+0x98c/0xc90 net/socket.c:2568
 ___sys_sendmsg+0x135/0x1e0 net/socket.c:2622
 __sys_sendmmsg+0x201/0x420 net/socket.c:2711
 __do_sys_sendmmsg net/socket.c:2738 [inline]
 __se_sys_sendmmsg net/socket.c:2735 [inline]
 __x64_sys_sendmmsg+0x9c/0x100 net/socket.c:2735
 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:0x7fbc0ab8cd29
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:00007fbc0bad2038 EFLAGS: 00000246 ORIG_RAX: 0000000000000133
RAX: ffffffffffffffda RBX: 00007fbc0ada5fa0 RCX: 00007fbc0ab8cd29
RDX: 000000000800001d RSI: 0000000020007fc0 RDI: 0000000000000006
RBP: 00007fbc0ac0e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007fbc0ada5fa0 R15: 00007fff3f069c58
 </TASK>

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5da38
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f0(buddy)
raw: 00fff00000000000 ffffea0000a75008 ffffea0001f59208 0000000000000000
raw: 0000000000000000 0000000000000002 00000000f0000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 2, migratetype Unmovable, gfp_mask 0x446dc0(GFP_KERNEL_ACCOUNT|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_COMP|__GFP_ZERO), pid 5815, tgid 5815 (syz-executor), ts 52943550716, free_ts 66670273983
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x2d1/0x350 mm/page_alloc.c:1558
 prep_new_page mm/page_alloc.c:1566 [inline]
 get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3476
 __alloc_pages_noprof+0x221/0x2470 mm/page_alloc.c:4753
 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline]
 alloc_pages_node_noprof include/linux/gfp.h:296 [inline]
 ___kmalloc_large_node+0x84/0x1b0 mm/slub.c:4243
 __kmalloc_large_node_noprof+0x1c/0x70 mm/slub.c:4270
 __do_kmalloc_node mm/slub.c:4286 [inline]
 __kmalloc_node_noprof.cold+0x5/0x5f mm/slub.c:4304
 __kvmalloc_node_noprof+0x6f/0x1a0 mm/util.c:645
 alloc_netdev_mqs+0xd9/0x15d0 net/core/dev.c:11470
 tun_set_iff drivers/net/tun.c:2837 [inline]
 __tun_chr_ioctl+0x2139/0x4b80 drivers/net/tun.c:3135
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:906 [inline]
 __se_sys_ioctl fs/ioctl.c:892 [inline]
 __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
 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
page last free pid 5994 tgid 5990 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:2659
 __folio_put+0x32a/0x450 mm/swap.c:112
 kvfree+0x47/0x50 mm/util.c:688
 device_release+0xa1/0x240 drivers/base/core.c:2567
 kobject_cleanup lib/kobject.c:689 [inline]
 kobject_release lib/kobject.c:720 [inline]
 kref_put include/linux/kref.h:65 [inline]
 kobject_put+0x1e4/0x5a0 lib/kobject.c:737
 netdev_run_todo+0x881/0x13d0 net/core/dev.c:11185
 rtnl_unlock net/core/rtnetlink.c:151 [inline]
 rtnl_net_unlock include/linux/rtnetlink.h:134 [inline]
 rtnl_dellink+0x3e6/0xaa0 net/core/rtnetlink.c:3535
 rtnetlink_rcv_msg+0x95b/0xea0 net/core/rtnetlink.c:6911
 netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2543
 netlink_unicast_kernel net/netlink/af_netlink.c:1322 [inline]
 netlink_unicast+0x53c/0x7f0 net/netlink/af_netlink.c:1348
 netlink_sendmsg+0x8b8/0xd70 net/netlink/af_netlink.c:1892
 sock_sendmsg_nosec net/socket.c:713 [inline]
 __sock_sendmsg net/socket.c:728 [inline]
 ____sys_sendmsg+0xaaf/0xc90 net/socket.c:2568
 ___sys_sendmsg+0x135/0x1e0 net/socket.c:2622
 __sys_sendmsg+0x16e/0x220 net/socket.c:2654
 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

Memory state around the buggy address:
 ffff88805da38000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88805da38080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff88805da38100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                      ^
 ffff88805da38180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff88805da38200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/01/24 02:44 upstream d0d106a2bd21 f6a35ef3 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: use-after-free Read in ip_dst_mtu_maybe_forward
* Struck through repros no longer work on HEAD.