================================================================== BUG: KASAN: double-free or invalid-free in slab_free mm/slub.c:3212 [inline] BUG: KASAN: double-free or invalid-free in kfree+0xc3/0x290 mm/slub.c:4200 CPU: 1 PID: 5363 Comm: syz-executor.1 Not tainted 5.10.134-syzkaller-01772-gf6ce9a9115d5 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3c0 mm/kasan/report.c:233 kasan_report_invalid_free+0x58/0x90 mm/kasan/report.c:358 ____kasan_slab_free+0x139/0x160 mm/kasan/common.c:362 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5530 security_tun_dev_free_security+0x4d/0x90 security/security.c:2263 tun_free_netdev+0xbd/0x1c0 drivers/net/tun.c:2277 netdev_run_todo+0xbcd/0xe10 net/core/dev.c:10304 rtnl_unlock+0xe/0x10 net/core/rtnetlink.c:112 __tun_chr_ioctl+0x8ca/0x2130 drivers/net/tun.c:3362 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:3371 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 RIP: 0033:0x7f4561cef209 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:00007f4560e44168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f4561e02030 RCX: 00007f4561cef209 RDX: 0000000020000200 RSI: 00000000400454ca RDI: 0000000000000003 RBP: 00007f4561d49161 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffec11f587f R14: 00007f4560e44300 R15: 0000000000022000 Allocated by task 5363: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:428 [inline] ____kasan_kmalloc+0xdc/0x110 mm/kasan/common.c:507 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:516 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x1dd/0x330 mm/slub.c:2983 kmalloc include/linux/slab.h:552 [inline] kzalloc include/linux/slab.h:664 [inline] selinux_tun_dev_alloc_security+0x51/0x140 security/selinux/hooks.c:5519 security_tun_dev_alloc_security+0x50/0xb0 security/security.c:2257 tun_set_iff+0x944/0x1100 drivers/net/tun.c:2795 __tun_chr_ioctl+0x8ab/0x2130 drivers/net/tun.c:3095 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:3371 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 Freed by task 5363: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:357 ____kasan_slab_free+0x121/0x160 mm/kasan/common.c:360 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:368 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1604 [inline] slab_free_freelist_hook+0xcc/0x1a0 mm/slub.c:1630 slab_free mm/slub.c:3212 [inline] kfree+0xc3/0x290 mm/slub.c:4200 selinux_tun_dev_free_security+0x15/0x20 security/selinux/hooks.c:5530 security_tun_dev_free_security+0x4d/0x90 security/security.c:2263 tun_set_iff+0xc98/0x1100 drivers/net/tun.c:2850 __tun_chr_ioctl+0x8ab/0x2130 drivers/net/tun.c:3095 tun_chr_ioctl+0x2a/0x40 drivers/net/tun.c:3371 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl+0x115/0x190 fs/ioctl.c:739 __x64_sys_ioctl+0x7b/0x90 fs/ioctl.c:739 do_syscall_64+0x34/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x61/0xc6 The buggy address belongs to the object at ffff888119539118 which belongs to the cache kmalloc-8 of size 8 The buggy address is located 0 bytes inside of 8-byte region [ffff888119539118, ffff888119539120) The buggy address belongs to the page: page:ffffea0004654e40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x119539 flags: 0x8000000000000200(slab) raw: 8000000000000200 ffffea0004027ec0 0000000200000002 ffff888100043c80 raw: 0000000000000000 0000000000660066 00000001ffffffff 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 902, ts 35559548911, free_ts 35093222089 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2385 [inline] prep_new_page mm/page_alloc.c:2391 [inline] get_page_from_freelist+0x745/0x760 mm/page_alloc.c:4067 __alloc_pages_nodemask+0x3b6/0x890 mm/page_alloc.c:5117 alloc_slab_page mm/slub.c:1815 [inline] allocate_slab+0x78/0x540 mm/slub.c:1817 new_slab mm/slub.c:1878 [inline] new_slab_objects mm/slub.c:2636 [inline] ___slab_alloc+0x131/0x2e0 mm/slub.c:2800 __slab_alloc+0x63/0xa0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc_track_caller+0x23e/0x350 mm/slub.c:4545 kvasprintf+0xd6/0x180 lib/kasprintf.c:25 kvasprintf_const+0x5e/0x180 lib/kasprintf.c:49 kobject_set_name_vargs+0x61/0x120 lib/kobject.c:289 kobject_add_varg lib/kobject.c:384 [inline] kobject_init_and_add+0xdb/0x190 lib/kobject.c:473 rx_queue_add_kobject net/core/net-sysfs.c:1018 [inline] net_rx_queue_update_kobjects+0x18f/0x430 net/core/net-sysfs.c:1069 register_queue_kobjects net/core/net-sysfs.c:1750 [inline] netdev_register_kobject+0x231/0x320 net/core/net-sysfs.c:2001 register_netdevice+0x1246/0x1790 net/core/dev.c:10018 __ip_tunnel_create+0x2af/0x370 net/ipv4/ip_tunnel.c:267 ip_tunnel_init_net+0x29b/0x750 net/ipv4/ip_tunnel.c:1069 ipgre_init_net+0x24/0x30 net/ipv4/ip_gre.c:1021 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1331 [inline] free_pcp_prepare+0x18c/0x1c0 mm/page_alloc.c:1405 free_unref_page_prepare mm/page_alloc.c:3291 [inline] free_unref_page_list+0x11d/0x660 mm/page_alloc.c:3365 release_pages+0xb14/0xb50 mm/swap.c:1081 free_pages_and_swap_cache+0x97/0xb0 mm/swap_state.c:356 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:242 [inline] tlb_flush_mmu+0x8a0/0xa80 mm/mmu_gather.c:249 tlb_finish_mmu+0xd2/0x1f0 mm/mmu_gather.c:328 exit_mmap+0x319/0x5c0 mm/mmap.c:3320 __mmput+0x95/0x2c0 kernel/fork.c:1133 mmput+0x4b/0x50 kernel/fork.c:1154 exit_mm+0x5cd/0x790 kernel/exit.c:489 do_exit+0x5f2/0x2340 kernel/exit.c:800 do_group_exit+0x13a/0x300 kernel/exit.c:910 get_signal+0xe17/0x1440 kernel/signal.c:2781 arch_do_signal+0x8e/0x650 arch/x86/kernel/signal.c:805 exit_to_user_mode_loop+0xa3/0xe0 kernel/entry/common.c:161 exit_to_user_mode_prepare kernel/entry/common.c:191 [inline] syscall_exit_to_user_mode+0x77/0xa0 kernel/entry/common.c:266 Memory state around the buggy address: ffff888119539000: fa fc fc fc fc fa fc fc fc fc fa fc fc fc fc fa ffff888119539080: fc fc fc fc fa fc fc fc fc fa fc fc fc fc fa fc >ffff888119539100: fc fc fc fa fc fc fc fc fa fc fc fc fc fa fc fc ^ ffff888119539180: fc fc fa fc fc fc fc fa fc fc fc fc fa fc fc fc ffff888119539200: fc 04 fc fc fc fc fa fc fc fc fc fa fc fc fc fc ==================================================================