syzbot


KASAN: use-after-free Read in xsk_diag_dump

Status: auto-obsoleted due to no activity on 2023/12/16 03:15
Reported-by: syzbot+4132131bd0924c752121@syzkaller.appspotmail.com
First crash: 253d, last: 245d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in xsk_diag_dump 2 252d 256d 0/3 auto-obsoleted due to no activity on 2023/12/09 18:57
upstream KASAN: slab-use-after-free Read in xsk_diag_dump net bpf C done 9 245d 254d 23/26 fixed on 2023/10/12 12:48

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in xsk_diag_put_info net/xdp/xsk_diag.c:21 [inline]
BUG: KASAN: use-after-free in xsk_diag_fill net/xdp/xsk_diag.c:114 [inline]
BUG: KASAN: use-after-free in xsk_diag_dump+0x1452/0x1970 net/xdp/xsk_diag.c:163
Read of size 4 at addr ffff8880157b00d0 by task syz-executor.5/30362

CPU: 0 PID: 30362 Comm: syz-executor.5 Not tainted 5.15.131-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description+0x63/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0x16b/0x1c0 mm/kasan/report.c:451
 xsk_diag_put_info net/xdp/xsk_diag.c:21 [inline]
 xsk_diag_fill net/xdp/xsk_diag.c:114 [inline]
 xsk_diag_dump+0x1452/0x1970 net/xdp/xsk_diag.c:163
 netlink_dump+0x606/0xc40 net/netlink/af_netlink.c:2279
 __netlink_dump_start+0x52f/0x6f0 net/netlink/af_netlink.c:2384
 netlink_dump_start include/linux/netlink.h:258 [inline]
 xsk_diag_handler_dump+0x1d5/0x260 net/xdp/xsk_diag.c:190
 sock_diag_rcv_msg+0xd5/0x400
 netlink_rcv_skb+0x1cf/0x410 net/netlink/af_netlink.c:2505
 sock_diag_rcv+0x26/0x40 net/core/sock_diag.c:276
 netlink_unicast_kernel net/netlink/af_netlink.c:1330 [inline]
 netlink_unicast+0x7b6/0x980 net/netlink/af_netlink.c:1356
 netlink_sendmsg+0xa30/0xd60 net/netlink/af_netlink.c:1924
 sock_sendmsg_nosec net/socket.c:704 [inline]
 sock_sendmsg net/socket.c:724 [inline]
 sock_write_iter+0x39b/0x530 net/socket.c:1060
 do_iter_readv_writev+0x594/0x7a0
 do_iter_write+0x1ea/0x760 fs/read_write.c:855
 vfs_writev fs/read_write.c:928 [inline]
 do_writev+0x281/0x470 fs/read_write.c:971
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7fd456c20ae9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd4551810c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000014
RAX: ffffffffffffffda RBX: 00007fd456d40050 RCX: 00007fd456c20ae9
RDX: 0000000000000001 RSI: 0000000020000000 RDI: 0000000000000004
RBP: 00007fd456c6c47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000006e R14: 00007fd456d40050 R15: 00007ffc80afe8d8
 </TASK>

The buggy address belongs to the page:
page:ffffea000055ec00 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x157b0
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000000 ffffea000086f208 ffffea0000d29808 0000000000000000
raw: 0000000000000000 0000000000000003 00000000ffffff7f 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x1100dc2(GFP_HIGHUSER|__GFP_ZERO|__GFP_SKIP_KASAN_POISON), pid 30331, ts 1774246209527, free_ts 1774537042261
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159
 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421
 alloc_pages_vma+0x39a/0x800 mm/mempolicy.c:2146
 do_anonymous_page mm/memory.c:3808 [inline]
 handle_pte_fault mm/memory.c:4619 [inline]
 __handle_mm_fault mm/memory.c:4756 [inline]
 handle_mm_fault+0x2f49/0x5950 mm/memory.c:4854
 faultin_page mm/gup.c:976 [inline]
 __get_user_pages+0x4ed/0x11d0 mm/gup.c:1197
 __get_user_pages_locked mm/gup.c:1382 [inline]
 __gup_longterm_locked+0x260/0xfa0 mm/gup.c:1952
 xdp_umem_pin_pages net/xdp/xdp_umem.c:107 [inline]
 xdp_umem_reg net/xdp/xdp_umem.c:220 [inline]
 xdp_umem_create+0x8f4/0xea0 net/xdp/xdp_umem.c:253
 xsk_setsockopt+0x7dd/0xa00 net/xdp/xsk.c:1120
 __sys_setsockopt+0x57e/0x990 net/socket.c:2179
 __do_sys_setsockopt net/socket.c:2190 [inline]
 __se_sys_setsockopt net/socket.c:2187 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2187
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317
 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396
 unpin_user_pages_dirty_lock+0x2cf/0x4c0 mm/gup.c:366
 xdp_umem_unpin_pages net/xdp/xdp_umem.c:28 [inline]
 xdp_umem_release+0xda/0x220 net/xdp/xdp_umem.c:63
 process_one_work+0x8a1/0x10c0 kernel/workqueue.c:2310
 worker_thread+0xaca/0x1280 kernel/workqueue.c:2457
 kthread+0x3f6/0x4f0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Memory state around the buggy address:
 ffff8880157aff80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880157b0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8880157b0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
                                                 ^
 ffff8880157b0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
 ffff8880157b0180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/07 03:14 linux-5.15.y aff03380bda4 72324844 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in xsk_diag_dump
2023/08/30 12:02 linux-5.15.y 5ddfe5cc8716 84803932 .config console log report info ci2-linux-5-15-kasan KASAN: use-after-free Read in xsk_diag_dump
* Struck through repros no longer work on HEAD.