================================================================== BUG: KASAN: use-after-free in nexthop_flush_dev+0x20b/0x230 net/ipv4/nexthop.c:2381 Read of size 8 at addr ffff888042ed2058 by task syz-executor.2/3710 CPU: 2 PID: 3710 Comm: syz-executor.2 Not tainted 5.19.0-rc6-syzkaller-00115-g4a57a8400075 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x467 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 nexthop_flush_dev+0x20b/0x230 net/ipv4/nexthop.c:2381 nh_netdev_event+0x2c6/0x370 net/ipv4/nexthop.c:3574 notifier_call_chain+0xb5/0x200 kernel/notifier.c:87 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:1945 call_netdevice_notifiers_extack net/core/dev.c:1983 [inline] call_netdevice_notifiers net/core/dev.c:1997 [inline] netdev_wait_allrefs_any net/core/dev.c:10227 [inline] netdev_run_todo+0xbc0/0x10f0 net/core/dev.c:10341 tun_detach drivers/net/tun.c:704 [inline] tun_chr_close+0xe0/0x180 drivers/net/tun.c:3455 __fput+0x277/0x9d0 fs/file_table.c:317 task_work_run+0xdd/0x1a0 kernel/task_work.c:177 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0xade/0x29d0 kernel/exit.c:795 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 __do_sys_exit_group kernel/exit.c:936 [inline] __se_sys_exit_group kernel/exit.c:934 [inline] __x64_sys_exit_group+0x3a/0x50 kernel/exit.c:934 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f740bc89199 Code: Unable to access opcode bytes at RIP 0x7f740bc8916f. RSP: 002b:00007fff1e1429a8 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007fff1e143230 RCX: 00007f740bc89199 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000043 RBP: 0000000000000000 R08: 0000000000000026 R09: 00007fff1e143230 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f740bcd27f0 R13: 0000000000000002 R14: 0000000000000003 R15: 00007fff1e143270 Allocated by task 3710: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:524 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3569 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] nexthop_net_init+0x71/0x140 net/ipv4/nexthop.c:3753 ops_init+0xaf/0x470 net/core/net_namespace.c:134 setup_net+0x5d1/0xc50 net/core/net_namespace.c:325 copy_net_ns+0x318/0x760 net/core/net_namespace.c:471 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3165 __do_sys_unshare kernel/fork.c:3236 [inline] __se_sys_unshare kernel/fork.c:3234 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3234 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 12: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x13d/0x180 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3425 [inline] kfree+0x113/0x310 mm/slab.c:3796 nexthop_net_exit_batch+0x245/0x2d0 net/ipv4/nexthop.c:3743 ops_exit_list+0x125/0x170 net/core/net_namespace.c:167 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:594 process_one_work+0x996/0x1610 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e9/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff888042ed2000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 88 bytes inside of 2048-byte region [ffff888042ed2000, ffff888042ed2800) The buggy address belongs to the physical page: page:ffffea00010bb480 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x42ed2 flags: 0x4fff00000000200(slab|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000200 ffffea00010cfdc8 ffffea000143ea48 ffff888011840800 raw: 0000000000000000 ffff888042ed2000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x40cc0(GFP_KERNEL|__GFP_COMP), pid 3710, tgid 3710 (syz-executor.2), ts 203242680280, free_ts 203232017405 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x1290/0x3b70 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 __alloc_pages_node include/linux/gfp.h:587 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x350 mm/slab.c:2569 fallback_alloc+0x1e4/0x2e0 mm/slab.c:3118 __do_cache_alloc mm/slab.c:3260 [inline] slab_alloc mm/slab.c:3295 [inline] kmem_cache_alloc_trace+0x309/0x4a0 mm/slab.c:3567 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] nexthop_net_init+0x71/0x140 net/ipv4/nexthop.c:3753 ops_init+0xaf/0x470 net/core/net_namespace.c:134 setup_net+0x5d1/0xc50 net/core/net_namespace.c:325 copy_net_ns+0x318/0x760 net/core/net_namespace.c:471 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3165 __do_sys_unshare kernel/fork.c:3236 [inline] __se_sys_unshare kernel/fork.c:3234 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3234 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3438 slab_destroy mm/slab.c:1615 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1635 __cache_free_alien mm/slab.c:774 [inline] cache_free_alien mm/slab.c:790 [inline] ___cache_free+0x296/0x670 mm/slab.c:3453 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1b0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slab.c:3239 [inline] kmem_cache_alloc_node_trace+0x2ff/0x5b0 mm/slab.c:3611 __do_kmalloc_node mm/slab.c:3633 [inline] __kmalloc_node+0x38/0x60 mm/slab.c:3641 kmalloc_node include/linux/slab.h:623 [inline] kvmalloc_node+0x3e/0x190 mm/util.c:613 kvmalloc include/linux/slab.h:750 [inline] kvzalloc include/linux/slab.h:758 [inline] proc_sys_call_handler+0x377/0x6e0 fs/proc/proc_sysctl.c:594 call_read_iter include/linux/fs.h:2052 [inline] new_sync_read+0x384/0x5f0 fs/read_write.c:401 vfs_read+0x492/0x5d0 fs/read_write.c:482 ksys_read+0x127/0x250 fs/read_write.c:620 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888042ed1f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888042ed1f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888042ed2000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888042ed2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888042ed2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================