================================================================== BUG: KASAN: use-after-free in nexthop_flush_dev net/ipv4/nexthop.c:2382 [inline] BUG: KASAN: use-after-free in nh_netdev_event+0x13c/0x940 net/ipv4/nexthop.c:3575 Read of size 8 at addr ffff88802f55f058 by task syz-executor.5/3638 CPU: 1 PID: 3638 Comm: syz-executor.5 Not tainted 6.0.0-rc3-syzkaller-00031-gc5e4d5e99162 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 print_address_description+0x65/0x4b0 mm/kasan/report.c:317 print_report+0x108/0x220 mm/kasan/report.c:433 kasan_report+0xfb/0x130 mm/kasan/report.c:495 nexthop_flush_dev net/ipv4/nexthop.c:2382 [inline] nh_netdev_event+0x13c/0x940 net/ipv4/nexthop.c:3575 notifier_call_chain kernel/notifier.c:87 [inline] raw_notifier_call_chain+0xe7/0x170 kernel/notifier.c:455 call_netdevice_notifiers_info net/core/dev.c:1945 [inline] 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:10250 [inline] netdev_run_todo+0x8fb/0x1090 net/core/dev.c:10364 tun_detach drivers/net/tun.c:704 [inline] tun_chr_close+0x11f/0x130 drivers/net/tun.c:3455 __fput+0x3b9/0x820 fs/file_table.c:320 task_work_run+0x146/0x1c0 kernel/task_work.c:177 exit_task_work include/linux/task_work.h:38 [inline] do_exit+0x55e/0x20a0 kernel/exit.c:795 do_group_exit+0x23b/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+0x3b/0x40 kernel/exit.c:934 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f2d34289279 Code: Unable to access opcode bytes at RIP 0x7f2d3428924f. RSP: 002b:00007fff912cea48 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 RAX: ffffffffffffffda RBX: 00007fff912cebf0 RCX: 00007f2d34289279 RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000043 RBP: 0000000000000000 R08: 0000000000000025 R09: 00007fff912cebf0 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2d342e32ba R13: 000000000000001c R14: 0000000000000006 R15: 00007fff912cec30 Allocated by task 3638: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:437 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x97/0x310 mm/slub.c:3284 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] nexthop_net_init+0x71/0x100 net/ipv4/nexthop.c:3754 ops_init+0x313/0x430 net/core/net_namespace.c:135 setup_net+0x4bb/0xc10 net/core/net_namespace.c:326 copy_net_ns+0x359/0x5b0 net/core/net_namespace.c:472 create_new_namespaces+0x4db/0x8e0 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0x11e/0x180 kernel/nsproxy.c:227 ksys_unshare+0x57f/0xb30 kernel/fork.c:3183 __do_sys_unshare kernel/fork.c:3254 [inline] __se_sys_unshare kernel/fork.c:3252 [inline] __x64_sys_unshare+0x34/0x40 kernel/fork.c:3252 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Freed by task 8: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x70 mm/kasan/common.c:45 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:370 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:367 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x12e/0x1a0 mm/slub.c:1780 slab_free mm/slub.c:3534 [inline] kfree+0xda/0x210 mm/slub.c:4562 nexthop_net_exit_batch+0x24b/0x2a0 net/ipv4/nexthop.c:3744 ops_exit_list net/core/net_namespace.c:168 [inline] cleanup_net+0x80c/0xc50 net/core/net_namespace.c:595 process_one_work+0x81c/0xd10 kernel/workqueue.c:2289 worker_thread+0xb14/0x1330 kernel/workqueue.c:2436 kthread+0x266/0x300 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 The buggy address belongs to the object at ffff88802f55f000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 88 bytes inside of 2048-byte region [ffff88802f55f000, ffff88802f55f800) The buggy address belongs to the physical page: page:ffffea0000bd5600 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88802f558000 pfn:0x2f558 head:ffffea0000bd5600 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00009e0008 ffffea0000c6f008 ffff888012042000 raw: ffff88802f558000 0000000000080006 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3637, tgid 3637 (syz-executor.2), ts 179192938204, free_ts 0 prep_new_page mm/page_alloc.c:2532 [inline] get_page_from_freelist+0x72b/0x7a0 mm/page_alloc.c:4283 __alloc_pages+0x259/0x560 mm/page_alloc.c:5515 alloc_slab_page+0x70/0xf0 mm/slub.c:1824 allocate_slab+0x5e/0x520 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x42e/0xce0 mm/slub.c:3031 __slab_alloc mm/slub.c:3118 [inline] slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] kmem_cache_alloc_trace+0x25f/0x310 mm/slub.c:3282 kmalloc include/linux/slab.h:600 [inline] rtnl_newlink+0xe6/0x2060 net/core/rtnetlink.c:3589 rtnetlink_rcv_msg+0x7c9/0xeb0 net/core/rtnetlink.c:6090 netlink_rcv_skb+0x1f0/0x460 net/netlink/af_netlink.c:2501 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x7e7/0x9c0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x9b3/0xcd0 net/netlink/af_netlink.c:1921 sock_sendmsg_nosec net/socket.c:714 [inline] sock_sendmsg net/socket.c:734 [inline] __sys_sendto+0x46d/0x5f0 net/socket.c:2117 __do_sys_sendto net/socket.c:2129 [inline] __se_sys_sendto net/socket.c:2125 [inline] __x64_sys_sendto+0xda/0xf0 net/socket.c:2125 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page_owner free stack trace missing Memory state around the buggy address: ffff88802f55ef00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88802f55ef80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff88802f55f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88802f55f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88802f55f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================