================================================================== BUG: KASAN: use-after-free in dev_map_generic_redirect+0xa0/0x650 kernel/bpf/devmap.c:668 Read of size 8 at addr ffff888068350380 by task syz.9.2683/13886 CPU: 0 PID: 13886 Comm: syz.9.2683 Not tainted 6.1.116-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __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:284 [inline] print_report+0x15f/0x4f0 mm/kasan/report.c:395 kasan_report+0x136/0x160 mm/kasan/report.c:495 dev_map_generic_redirect+0xa0/0x650 kernel/bpf/devmap.c:668 xdp_do_generic_redirect_map net/core/filter.c:4392 [inline] xdp_do_generic_redirect+0x4bf/0x850 net/core/filter.c:4451 do_xdp_generic+0x50b/0x6d0 net/core/dev.c:4955 __netif_receive_skb_core+0x1c88/0x41d0 net/core/dev.c:5357 __netif_receive_skb_one_core net/core/dev.c:5534 [inline] __netif_receive_skb+0x11c/0x530 net/core/dev.c:5650 netif_receive_skb_internal net/core/dev.c:5736 [inline] netif_receive_skb+0x1f4/0x890 net/core/dev.c:5795 tun_rx_batched+0x1b3/0x8e0 drivers/net/tun.c:1548 tun_get_user+0x2c03/0x42d0 drivers/net/tun.c:1998 tun_chr_write_iter+0x10c/0x1f0 drivers/net/tun.c:2044 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x857/0xbc0 fs/read_write.c:584 ksys_write+0x19c/0x2c0 fs/read_write.c:637 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 RIP: 0033:0x7fe76217d1ff Code: 89 54 24 18 48 89 74 24 10 89 7c 24 08 e8 c9 8d 02 00 48 8b 54 24 18 48 8b 74 24 10 41 89 c0 8b 7c 24 08 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 31 44 89 c7 48 89 44 24 08 e8 1c 8e 02 00 48 RSP: 002b:00007fe763000000 EFLAGS: 00000293 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007fe762335f80 RCX: 00007fe76217d1ff RDX: 000000000000006a RSI: 0000000020000180 RDI: 00000000000000c8 RBP: 00007fe7621f175e R08: 0000000000000000 R09: 0000000000000000 R10: 000000000000006a R11: 0000000000000293 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fe762335f80 R15: 00007fff01cf4618 Allocated by task 13800: 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 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:693 [inline] get_undo_list ipc/sem.c:1856 [inline] copy_semundo+0xb1/0x230 ipc/sem.c:2314 copy_process+0x1848/0x4060 kernel/fork.c:2249 kernel_clone+0x222/0x920 kernel/fork.c:2679 __do_sys_clone3 kernel/fork.c:2978 [inline] __se_sys_clone3+0x373/0x410 kernel/fork.c:2962 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 13801: 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 exit_sem+0x197a/0x19e0 ipc/sem.c:2447 do_exit+0xa44/0x26a0 kernel/exit.c:864 do_group_exit+0x202/0x2b0 kernel/exit.c:1021 get_signal+0x16f7/0x17d0 kernel/signal.c:2870 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff888068350380 which belongs to the cache kmalloc-cg-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ffff888068350380, ffff8880683503e0) The buggy address belongs to the physical page: page:ffffea0001a0d400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x68350 memcg:ffff888028720801 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0001d769c0 dead000000000006 ffff888017c428c0 raw: 0000000000000000 0000000000200020 00000001ffffffff ffff888028720801 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 9676, tgid 9676 (syz.8.1546), ts 286345016789, free_ts 286194811470 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x18d/0x1b0 mm/page_alloc.c:2517 prep_new_page mm/page_alloc.c:2524 [inline] get_page_from_freelist+0x3731/0x38d0 mm/page_alloc.c:4313 __alloc_pages+0x28d/0x770 mm/page_alloc.c:5589 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 kmalloc_trace+0x26/0xe0 mm/slab_common.c:1026 kmalloc include/linux/slab.h:557 [inline] kzalloc include/linux/slab.h:693 [inline] get_undo_list ipc/sem.c:1856 [inline] copy_semundo+0xb1/0x230 ipc/sem.c:2314 copy_process+0x1848/0x4060 kernel/fork.c:2249 kernel_clone+0x222/0x920 kernel/fork.c:2679 __do_sys_clone3 kernel/fork.c:2978 [inline] __se_sys_clone3+0x373/0x410 kernel/fork.c:2962 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 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1444 [inline] free_pcp_prepare mm/page_alloc.c:1494 [inline] free_unref_page_prepare+0xf63/0x1120 mm/page_alloc.c:3369 free_unref_page_list+0x663/0x900 mm/page_alloc.c:3510 release_pages+0x2836/0x2b40 mm/swap.c:1055 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+0x3c3/0x9f0 mm/mmap.c:3239 __mmput+0x115/0x3c0 kernel/fork.c:1199 exit_mm+0x226/0x300 kernel/exit.c:565 do_exit+0x9f6/0x26a0 kernel/exit.c:858 do_group_exit+0x202/0x2b0 kernel/exit.c:1021 get_signal+0x16f7/0x17d0 kernel/signal.c:2870 arch_do_signal_or_restart+0xb0/0x1a10 arch/x86/kernel/signal.c:871 exit_to_user_mode_loop+0x6a/0x100 kernel/entry/common.c:174 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:210 __syscall_exit_to_user_mode_work kernel/entry/common.c:292 [inline] syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:303 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:87 Memory state around the buggy address: ffff888068350280: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888068350300: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc >ffff888068350380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff888068350400: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ffff888068350480: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================