syzbot


KASAN: use-after-free Read in dev_map_generic_redirect

Status: upstream: reported on 2024/08/19 13:49
Reported-by: syzbot+d3199baa0cdf04ff148c@syzkaller.appspotmail.com
First crash: 273d, last: 19d
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-1 general protection fault in dev_map_generic_redirect origin:lts syz 97 46d 412d 0/2 premoderation: reported syz repro on 2024/04/02 16:15
linux-5.15 KASAN: use-after-free Read in dev_map_generic_redirect 9 26d 123d 0/3 upstream: reported on 2025/01/16 19:30
android-5-15 KASAN: use-after-free Read in dev_map_generic_redirect 27 12d 123d 0/2 premoderation: reported on 2025/01/16 07:29
upstream BUG: unable to handle kernel NULL pointer dereference in dev_map_generic_redirect bpf net 20 307d 406d 0/28 auto-obsoleted due to no activity on 2024/10/01 02:11

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x650 kernel/bpf/devmap.c:668
Read of size 8 at addr ffff8880799fc380 by task kworker/0:10/4644

CPU: 0 PID: 4644 Comm: kworker/0:10 Not tainted 6.1.133-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025
Workqueue: wg-crypt-wg0 wg_packet_tx_worker
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:316 [inline]
 print_report+0x15f/0x4f0 mm/kasan/report.c:427
 kasan_report+0x136/0x160 mm/kasan/report.c:531
 dev_map_generic_redirect+0xa0/0x650 kernel/bpf/devmap.c:668
 xdp_do_generic_redirect_map net/core/filter.c:4416 [inline]
 xdp_do_generic_redirect+0x4c4/0x850 net/core/filter.c:4475
 do_xdp_generic+0x50b/0x6d0 net/core/dev.c:4988
 __netif_receive_skb_core+0x1c88/0x41d0 net/core/dev.c:5390
 __netif_receive_skb_one_core net/core/dev.c:5567 [inline]
 __netif_receive_skb+0x11c/0x530 net/core/dev.c:5683
 process_backlog+0x381/0x760 net/core/dev.c:6011
 __napi_poll+0xc7/0x470 net/core/dev.c:6578
 napi_poll net/core/dev.c:6645 [inline]
 net_rx_action+0x70f/0xeb0 net/core/dev.c:6759
 handle_softirqs+0x2ee/0xa40 kernel/softirq.c:578
 do_softirq+0x162/0x240 kernel/softirq.c:479
 </IRQ>
 <TASK>
 __local_bh_enable_ip+0x1b1/0x1f0 kernel/softirq.c:403
 wg_socket_send_skb_to_peer+0x172/0x1d0 drivers/net/wireguard/socket.c:184
 wg_packet_create_data_done drivers/net/wireguard/send.c:251 [inline]
 wg_packet_tx_worker+0x1bb/0x810 drivers/net/wireguard/send.c:276
 process_one_work+0x917/0x1260 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
 </TASK>

Allocated by task 18299:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0x97/0xb0 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 __do_kmalloc_node mm/slab_common.c:936 [inline]
 __kmalloc_node+0xb3/0x230 mm/slab_common.c:943
 kmalloc_node include/linux/slab.h:589 [inline]
 bpf_map_kmalloc_node+0xce/0x1c0 kernel/bpf/syscall.c:452
 __dev_map_alloc_node+0x56/0x4d0 kernel/bpf/devmap.c:851
 __dev_map_update_elem kernel/bpf/devmap.c:916 [inline]
 dev_map_update_elem+0x20e/0x3f0 kernel/bpf/devmap.c:935
 bpf_map_update_value+0x5cf/0x6f0 kernel/bpf/syscall.c:226
 map_update_elem+0x503/0x680 kernel/bpf/syscall.c:1463
 __sys_bpf+0x337/0x6c0 kernel/bpf/syscall.c:5005
 __do_sys_bpf kernel/bpf/syscall.c:5121 [inline]
 __se_sys_bpf kernel/bpf/syscall.c:5119 [inline]
 __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:5119
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Freed by task 16777:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:52
 kasan_save_free_info+0x27/0x40 mm/kasan/generic.c:516
 ____kasan_slab_free+0xd6/0x120 mm/kasan/common.c:236
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x25c/0x3c0 mm/slub.c:3674
 dev_map_free+0x571/0x690 kernel/bpf/devmap.c:238
 process_one_work+0x917/0x1260 kernel/workqueue.c:2292
 worker_thread+0xa47/0x1200 kernel/workqueue.c:2439
 kthread+0x28d/0x320 kernel/kthread.c:376
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Last potentially related work creation:
 kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xb0/0xc0 mm/kasan/generic.c:486
 call_rcu+0x163/0xa10 kernel/rcu/tree.c:2845
 nf_hook_entries_free net/netfilter/core.c:88 [inline]
 __nf_register_net_hook+0x71c/0x8d0 net/netfilter/core.c:445
 nf_register_net_hook+0xac/0x180 net/netfilter/core.c:566
 nf_register_net_hooks+0x3d/0x1a0 net/netfilter/core.c:582
 brnf_device_event+0x13d/0x1d0 net/bridge/br_netfilter_hooks.c:1128
 notifier_call_chain kernel/notifier.c:87 [inline]
 raw_notifier_call_chain+0xd0/0x170 kernel/notifier.c:455
 call_netdevice_notifiers_extack net/core/dev.c:2039 [inline]
 call_netdevice_notifiers net/core/dev.c:2053 [inline]
 register_netdevice+0x1630/0x1ab0 net/core/dev.c:10225
 br_dev_newlink+0x23/0x100 net/bridge/br_netlink.c:1499
 rtnl_newlink_create net/core/rtnetlink.c:3419 [inline]
 __rtnl_newlink net/core/rtnetlink.c:3639 [inline]
 rtnl_newlink+0x14ed/0x2060 net/core/rtnetlink.c:3652
 rtnetlink_rcv_msg+0x822/0x1000 net/core/rtnetlink.c:6150
 netlink_rcv_skb+0x1cd/0x410 net/netlink/af_netlink.c:2493
 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline]
 netlink_unicast+0x7e2/0x970 net/netlink/af_netlink.c:1337
 netlink_sendmsg+0xa26/0xd60 net/netlink/af_netlink.c:1859
 sock_sendmsg_nosec net/socket.c:718 [inline]
 __sock_sendmsg net/socket.c:730 [inline]
 __sys_sendto+0x480/0x600 net/socket.c:2153
 __do_sys_sendto net/socket.c:2165 [inline]
 __se_sys_sendto net/socket.c:2161 [inline]
 __x64_sys_sendto+0xda/0xf0 net/socket.c:2161
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

The buggy address belongs to the object at ffff8880799fc380
 which belongs to the cache kmalloc-cg-96 of size 96
The buggy address is located 0 bytes inside of
 96-byte region [ffff8880799fc380, ffff8880799fc3e0)

The buggy address belongs to the physical page:
page:ffffea0001e67f00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x799fc
memcg:ffff888027b18601
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea00016ab040 dead000000000005 ffff888017c428c0
raw: 0000000000000000 0000000000200020 00000001ffffffff ffff888027b18601
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112800(GFP_NOWAIT|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL), pid 9869, tgid 9867 (syz.9.1558), ts 322868739425, free_ts 322727901248
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2532
 prep_new_page mm/page_alloc.c:2539 [inline]
 get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4328
 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5606
 alloc_slab_page+0x6a/0x150 mm/slub.c:1794
 allocate_slab mm/slub.c:1939 [inline]
 new_slab+0x84/0x2d0 mm/slub.c:1992
 ___slab_alloc+0xc20/0x1270 mm/slub.c:3180
 __slab_alloc mm/slub.c:3279 [inline]
 slab_alloc_node mm/slub.c:3364 [inline]
 __kmem_cache_alloc_node+0x19f/0x260 mm/slub.c:3437
 __do_kmalloc_node mm/slab_common.c:935 [inline]
 __kmalloc_node+0xa2/0x230 mm/slab_common.c:943
 kmalloc_node include/linux/slab.h:589 [inline]
 __alloc kernel/bpf/memalloc.c:146 [inline]
 alloc_bulk+0x685/0x8d0 kernel/bpf/memalloc.c:174
 irq_work_single+0xd5/0x230 kernel/irq_work.c:211
 irq_work_run_list kernel/irq_work.c:242 [inline]
 irq_work_run+0x187/0x350 kernel/irq_work.c:251
 __sysvec_irq_work+0xbb/0x360 arch/x86/kernel/irq_work.c:22
 instr_sysvec_irq_work arch/x86/kernel/irq_work.c:17 [inline]
 sysvec_irq_work+0x98/0xc0 arch/x86/kernel/irq_work.c:17
 asm_sysvec_irq_work+0x16/0x20 arch/x86/include/asm/idtentry.h:728
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1459 [inline]
 free_pcp_prepare mm/page_alloc.c:1509 [inline]
 free_unref_page_prepare+0x12a6/0x15b0 mm/page_alloc.c:3384
 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3525
 release_pages+0x24c4/0x27a0 mm/swap.c:1035
 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline]
 tlb_flush_mmu_free mm/mmu_gather.c:254 [inline]
 tlb_flush_mmu+0xfc/0x210 mm/mmu_gather.c:261
 tlb_finish_mmu+0xce/0x1f0 mm/mmu_gather.c:361
 exit_mmap+0x3b3/0x980 mm/mmap.c:3250
 __mmput+0x115/0x3c0 kernel/fork.c:1200
 exit_mm+0x226/0x300 kernel/exit.c:565
 do_exit+0x9f1/0x26a0 kernel/exit.c:858
 do_group_exit+0x202/0x2b0 kernel/exit.c:1021
 __do_sys_exit_group kernel/exit.c:1032 [inline]
 __se_sys_exit_group kernel/exit.c:1030 [inline]
 __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1030
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Memory state around the buggy address:
 ffff8880799fc280: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8880799fc300: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc
>ffff8880799fc380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                   ^
 ffff8880799fc400: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff8880799fc480: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
==================================================================
vkms_vblank_simulate: vblank timer overrun

Crashes (29):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/04/09 23:58 linux-6.1.y 3dfebb87d7eb 988b336c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2025/04/09 23:58 linux-6.1.y 3dfebb87d7eb 988b336c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/04 02:40 linux-6.1.y 0cbb5f65e52f 8f267cef .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/03 13:59 linux-6.1.y 0cbb5f65e52f a21a8419 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2025/01/29 14:59 linux-6.1.y 75cefdf153f5 136953f1 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/11/17 19:08 linux-6.1.y b67dc5c9ade9 cfe3a04a .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/11/13 15:05 linux-6.1.y d7039b844a1c bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/11/13 15:05 linux-6.1.y d7039b844a1c bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/11/13 15:05 linux-6.1.y d7039b844a1c bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/11/13 15:03 linux-6.1.y d7039b844a1c bb3f8425 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/11/08 06:41 linux-6.1.y 7c15117f9468 179b040e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/09/13 03:14 linux-6.1.y 5f55cad62cc9 73e8a465 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/09/13 03:14 linux-6.1.y 5f55cad62cc9 73e8a465 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2024/08/28 15:06 linux-6.1.y ee5e09825b81 ef3de9e8 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan KASAN: use-after-free Read in dev_map_generic_redirect
2025/04/30 23:43 linux-6.1.y 535ec20c5027 ce7952f4 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/04/11 22:11 linux-6.1.y 420102835862 0bd6db41 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/03/29 19:24 linux-6.1.y 8e60a714ba3b d3999433 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/03/20 07:01 linux-6.1.y 344a09659766 9209bc22 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/03/20 07:01 linux-6.1.y 344a09659766 9209bc22 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/03/20 07:01 linux-6.1.y 344a09659766 9209bc22 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/03/05 07:57 linux-6.1.y 3a8358583626 c3901742 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/03/05 01:33 linux-6.1.y 3a8358583626 c3901742 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/21 16:10 linux-6.1.y 3a8358583626 0808a665 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/21 16:10 linux-6.1.y 3a8358583626 0808a665 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/21 16:10 linux-6.1.y 3a8358583626 0808a665 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/04 01:44 linux-6.1.y 0cbb5f65e52f 8f267cef .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/01/25 12:03 linux-6.1.y 75cefdf153f5 9fbd772e .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2024/08/19 13:48 linux-6.1.y ee5e09825b81 9f0ab3fb .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in dev_map_generic_redirect
2025/02/04 02:40 linux-6.1.y 0cbb5f65e52f 8f267cef .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan general protection fault in dev_map_generic_redirect
* Struck through repros no longer work on HEAD.