================================================================== BUG: KASAN: use-after-free in read_pnet include/net/net_namespace.h:414 [inline] BUG: KASAN: use-after-free in dev_net include/linux/netdevice.h:2738 [inline] BUG: KASAN: use-after-free in nf_hook_entry_head+0x2fe/0x310 net/netfilter/core.c:319 Read of size 8 at addr ffff88806fa14108 by task kworker/u32:3/61 CPU: 3 UID: 0 PID: 61 Comm: kworker/u32:3 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Workqueue: netns cleanup_net Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 read_pnet include/net/net_namespace.h:414 [inline] dev_net include/linux/netdevice.h:2738 [inline] nf_hook_entry_head+0x2fe/0x310 net/netfilter/core.c:319 __nf_unregister_net_hook+0x7e/0x660 net/netfilter/core.c:491 nf_unregister_net_hook+0xd5/0x110 net/netfilter/core.c:536 nft_unregister_flowtable_ops net/netfilter/nf_tables_api.c:9038 [inline] __nft_unregister_flowtable_net_hooks+0xfc/0x3f0 net/netfilter/nf_tables_api.c:9053 __nft_release_hook+0x26e/0x350 net/netfilter/nf_tables_api.c:12035 __nft_release_hooks net/netfilter/nf_tables_api.c:12049 [inline] nf_tables_pre_exit_net+0xc5/0x120 net/netfilter/nf_tables_api.c:12200 ops_pre_exit_list net/core/net_namespace.c:161 [inline] ops_undo_list+0x187/0xab0 net/core/net_namespace.c:234 cleanup_net+0x41b/0x830 net/core/net_namespace.c:696 process_one_work+0x9ba/0x1b20 kernel/workqueue.c:3257 process_scheduled_works kernel/workqueue.c:3340 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3421 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x983/0xb10 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff88806fa17400 pfn:0x6fa14 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 04fff00000000000 ffffea000133f908 ffffea0001cf6e08 0000000000000000 raw: ffff88806fa17400 0000000000000002 00000000f0000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x92800(GFP_NOWAIT|__GFP_NORETRY|__GFP_NOMEMALLOC), pid 11254, tgid 11247 (syz.6.847), ts 311284828487, free_ts 311284850127 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1af/0x220 mm/page_alloc.c:1846 prep_new_page mm/page_alloc.c:1854 [inline] get_page_from_freelist+0xd0b/0x31a0 mm/page_alloc.c:3915 __alloc_frozen_pages_noprof+0x25f/0x2430 mm/page_alloc.c:5210 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2486 alloc_frozen_pages_noprof mm/mempolicy.c:2557 [inline] alloc_pages_noprof+0x131/0x390 mm/mempolicy.c:2577 stack_depot_save_flags+0x8fe/0x9b0 lib/stackdepot.c:677 ref_tracker_free+0x11d/0x830 lib/ref_tracker.c:308 __netns_tracker_free include/net/net_namespace.h:379 [inline] put_net_track include/net/net_namespace.h:394 [inline] __sk_destruct+0x4b5/0xbc0 net/core/sock.c:2379 sk_destruct+0xc2/0xf0 net/core/sock.c:2412 __sk_free+0xf4/0x3e0 net/core/sock.c:2423 sk_free+0x6a/0x90 net/core/sock.c:2434 sock_put include/net/sock.h:1998 [inline] tun_detach drivers/net/tun.c:643 [inline] tun_chr_close+0x13f/0x230 drivers/net/tun.c:3436 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:233 get_signal+0x1d0/0x26d0 kernel/signal.c:2807 arch_do_signal_or_restart+0x8f/0x7a0 arch/x86/kernel/signal.c:337 page last free pid 11254 tgid 11247 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0x7df/0x1170 mm/page_alloc.c:2943 stack_depot_save_flags+0x352/0x9b0 lib/stackdepot.c:727 ref_tracker_free+0x11d/0x830 lib/ref_tracker.c:308 __netns_tracker_free include/net/net_namespace.h:379 [inline] put_net_track include/net/net_namespace.h:394 [inline] __sk_destruct+0x4b5/0xbc0 net/core/sock.c:2379 sk_destruct+0xc2/0xf0 net/core/sock.c:2412 __sk_free+0xf4/0x3e0 net/core/sock.c:2423 sk_free+0x6a/0x90 net/core/sock.c:2434 sock_put include/net/sock.h:1998 [inline] tun_detach drivers/net/tun.c:643 [inline] tun_chr_close+0x13f/0x230 drivers/net/tun.c:3436 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:233 get_signal+0x1d0/0x26d0 kernel/signal.c:2807 arch_do_signal_or_restart+0x8f/0x7a0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:41 [inline] exit_to_user_mode_loop+0x8c/0x540 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] __do_fast_syscall_32+0x4a4/0x680 arch/x86/entry/syscall_32.c:310 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Memory state around the buggy address: ffff88806fa14000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806fa14080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88806fa14100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88806fa14180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806fa14200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================