================================================================== BUG: KASAN: use-after-free in free_netdev+0x17d/0x310 net/core/dev.c:9696 Read of size 8 at addr ffff8881e61db578 by task syz-executor.5/15251 CPU: 1 PID: 15251 Comm: syz-executor.5 Not tainted 5.4.190-syzkaller-00045-g4cc9c9d71eec #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18e/0x1d5 lib/dump_stack.c:118 print_address_description+0x8c/0x630 mm/kasan/report.c:384 __kasan_report+0xf6/0x130 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 free_netdev+0x17d/0x310 net/core/dev.c:9696 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2500 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287 ___sys_sendmsg net/socket.c:2341 [inline] __sys_sendmsg+0x235/0x2f0 net/socket.c:2387 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f3c98283109 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f3c973f9168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f3c98395f60 RCX: 00007f3c98283109 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000004 RBP: 00007f3c982dd05d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd2d2e41ff R14: 00007f3c973f9300 R15: 0000000000022000 Allocated by task 15251: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x131/0x1e0 mm/kasan/common.c:529 kmalloc include/linux/slab.h:561 [inline] sk_prot_alloc+0xbc/0x3c0 net/core/sock.c:1618 sk_alloc+0x30/0x330 net/core/sock.c:1676 tun_chr_open+0x77/0x490 drivers/net/tun.c:3487 misc_open+0x346/0x3c0 drivers/char/misc.c:141 chrdev_open+0x4ec/0x5b0 fs/char_dev.c:414 do_dentry_open+0x7e3/0xef0 fs/open.c:796 do_last fs/namei.c:3495 [inline] path_openat+0x1464/0x3710 fs/namei.c:3612 do_filp_open+0x19a/0x3a0 fs/namei.c:3642 do_sys_open+0x2e3/0x700 fs/open.c:1113 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 15250: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x178/0x240 mm/kasan/common.c:487 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494 slab_free mm/slub.c:3080 [inline] kfree+0xc6/0x260 mm/slub.c:4071 sk_prot_free+0xa3/0x160 net/core/sock.c:1659 tun_detach drivers/net/tun.c:748 [inline] tun_chr_close+0xb4/0xd0 drivers/net/tun.c:3523 __fput+0x261/0x680 fs/file_table.c:281 task_work_run+0x186/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x1ba/0x1d0 arch/x86/entry/common.c:163 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881e61db000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1400 bytes inside of 2048-byte region [ffff8881e61db000, ffff8881e61db800) The buggy address belongs to the page: page:ffffea0007987600 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 0000000000000000 0000000100000001 ffff8881f5c0c000 raw: 0000000000000000 0000000000080008 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x194/0x380 mm/page_alloc.c:2171 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857 alloc_slab_page+0x39/0x3e0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x97/0x450 mm/slub.c:1749 new_slab_objects mm/slub.c:2506 [inline] ___slab_alloc+0x320/0x4b0 mm/slub.c:2667 __slab_alloc+0x5a/0x90 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc_trace+0x129/0x240 mm/slub.c:2854 kmalloc include/linux/slab.h:556 [inline] kzalloc include/linux/slab.h:690 [inline] copy_verifier_state+0x51e/0xef0 kernel/bpf/verifier.c:746 push_stack+0x184/0x7e0 kernel/bpf/verifier.c:819 check_cond_jmp_op+0x6a6/0x1750 kernel/bpf/verifier.c:6164 do_check+0x4ac8/0x9260 kernel/bpf/verifier.c:8081 bpf_check+0x2647/0xb220 kernel/bpf/verifier.c:9609 bpf_prog_load kernel/bpf/syscall.c:1724 [inline] __do_sys_bpf kernel/bpf/syscall.c:2889 [inline] __se_sys_bpf+0x7620/0xb990 kernel/bpf/syscall.c:2847 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] __free_pages_ok+0x7ee/0x920 mm/page_alloc.c:1438 put_page include/linux/mm.h:1150 [inline] __skb_frag_unref include/linux/skbuff.h:3002 [inline] skb_release_data+0x20d/0x690 net/core/skbuff.c:615 skb_release_all net/core/skbuff.c:675 [inline] __kfree_skb+0x55/0x170 net/core/skbuff.c:689 tcp_close+0x22a/0xfc0 net/ipv4/tcp.c:2379 inet_release+0x135/0x180 net/ipv4/af_inet.c:427 __sock_release net/socket.c:591 [inline] sock_close+0xd1/0x250 net/socket.c:1258 __fput+0x261/0x680 fs/file_table.c:281 task_work_run+0x186/0x1b0 kernel/task_work.c:113 get_signal+0x1375/0x13f0 kernel/signal.c:2529 do_signal+0x3b/0x540 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xdd/0x1d0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Memory state around the buggy address: ffff8881e61db400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e61db480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881e61db500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881e61db580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e61db600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================