================================================================== BUG: KASAN: double-free in slab_free mm/slub.c:3534 [inline] BUG: KASAN: double-free in kfree+0xe2/0x4d0 mm/slub.c:4562 CPU: 1 PID: 1863 Comm: syz-executor.2 Not tainted 5.19.0-rc4-next-20220628-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report_invalid_free+0x8f/0x1a0 mm/kasan/report.c:462 ____kasan_slab_free+0x18b/0x1c0 mm/kasan/common.c:355 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3534 [inline] kfree+0xe2/0x4d0 mm/slub.c:4562 kfree_const+0x51/0x60 mm/util.c:41 free_prealloced_shrinker+0x32/0x160 mm/vmscan.c:658 destroy_unused_super.part.0+0x106/0x170 fs/super.c:185 destroy_unused_super fs/super.c:278 [inline] alloc_super+0x8bd/0xaa0 fs/super.c:277 sget_fc+0x13e/0x7c0 fs/super.c:530 vfs_get_super fs/super.c:1134 [inline] get_tree_nodev+0x24/0x1d0 fs/super.c:1169 vfs_get_tree+0x89/0x2f0 fs/super.c:1501 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1320/0x1fa0 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 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+0x46/0xb0 RIP: 0033:0x7f8d45e89199 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:00007f8d44dfe168 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f8d45f9bf60 RCX: 00007f8d45e89199 RDX: 00000000200000c0 RSI: 0000000020000080 RDI: 0000000020000000 RBP: 00007f8d44dfe1d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000002 R13: 00007ffdeffad64f R14: 00007f8d44dfe300 R15: 0000000000022000 Allocated by task 3624: 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+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] apparmor_sk_alloc_security+0x84/0x150 security/apparmor/lsm.c:812 security_sk_alloc+0x50/0xb0 security/security.c:2274 sk_prot_alloc+0xdd/0x290 net/core/sock.c:1979 sk_alloc+0x36/0x770 net/core/sock.c:2029 inet_create net/ipv4/af_inet.c:319 [inline] inet_create+0x395/0xea0 net/ipv4/af_inet.c:245 __sock_create+0x353/0x790 net/socket.c:1515 sock_create net/socket.c:1566 [inline] __sys_socket_create net/socket.c:1603 [inline] __sys_socket_create net/socket.c:1588 [inline] __sys_socket+0x12f/0x240 net/socket.c:1636 __do_sys_socket net/socket.c:1649 [inline] __se_sys_socket net/socket.c:1647 [inline] __x64_sys_socket+0x6f/0xb0 net/socket.c:1647 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+0x46/0xb0 Freed by task 1863: 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+0x166/0x1c0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3534 [inline] kfree+0xe2/0x4d0 mm/slub.c:4562 kfree_const+0x51/0x60 mm/util.c:41 prealloc_shrinker+0x179/0x1b0 mm/vmscan.c:644 alloc_super+0x831/0xaa0 fs/super.c:268 sget_fc+0x13e/0x7c0 fs/super.c:530 vfs_get_super fs/super.c:1134 [inline] get_tree_nodev+0x24/0x1d0 fs/super.c:1169 vfs_get_tree+0x89/0x2f0 fs/super.c:1501 do_new_mount fs/namespace.c:3040 [inline] path_mount+0x1320/0x1fa0 fs/namespace.c:3370 do_mount fs/namespace.c:3383 [inline] __do_sys_mount fs/namespace.c:3591 [inline] __se_sys_mount fs/namespace.c:3568 [inline] __x64_sys_mount+0x27f/0x300 fs/namespace.c:3568 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+0x46/0xb0 The buggy address belongs to the object at ffff888022ca8680 which belongs to the cache kmalloc-16 of size 16 The buggy address is located 0 bytes inside of 16-byte region [ffff888022ca8680, ffff888022ca8690) The buggy address belongs to the physical page: page:ffffea00008b2a00 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22ca8 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 dead000000000100 dead000000000122 ffff8880118413c0 raw: 0000000000000000 0000000080800080 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 3626, tgid 3626 (syz-executor.5), ts 111110704127, free_ts 111047359885 prep_new_page mm/page_alloc.c:2535 [inline] get_page_from_freelist+0x210d/0x3a30 mm/page_alloc.c:4282 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5506 __alloc_pages_node include/linux/gfp.h:583 [inline] alloc_slab_page mm/slub.c:1826 [inline] allocate_slab+0x80/0x3d0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x89d/0xef0 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] __kmalloc_node+0x2e2/0x380 mm/slub.c:4468 kmalloc_node include/linux/slab.h:623 [inline] kvmalloc_node+0x3e/0x190 mm/util.c:581 xt_jumpstack_alloc net/netfilter/x_tables.c:1354 [inline] xt_replace_table+0x1a2/0x820 net/netfilter/x_tables.c:1393 __do_replace+0x1d7/0x890 net/ipv6/netfilter/ip6_tables.c:1084 do_replace net/ipv6/netfilter/ip6_tables.c:1157 [inline] do_ip6t_set_ctl+0x90d/0xb90 net/ipv6/netfilter/ip6_tables.c:1639 nf_setsockopt+0x83/0xe0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x122/0x180 net/ipv6/ipv6_sockglue.c:1026 tcp_setsockopt+0x136/0x2520 net/ipv4/tcp.c:3740 __sys_setsockopt+0x2d6/0x690 net/socket.c:2251 __do_sys_setsockopt net/socket.c:2262 [inline] __se_sys_setsockopt net/socket.c:2259 [inline] __x64_sys_setsockopt+0xba/0x150 net/socket.c:2259 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1453 [inline] free_pcp_prepare+0x5e4/0xd20 mm/page_alloc.c:1503 free_unref_page_prepare mm/page_alloc.c:3383 [inline] free_unref_page_list+0x16f/0xb90 mm/page_alloc.c:3525 release_pages+0xbe8/0x1810 mm/swap.c:1017 tlb_batch_pages_flush+0xa8/0x1a0 mm/mmu_gather.c:58 tlb_flush_mmu_free mm/mmu_gather.c:255 [inline] tlb_flush_mmu mm/mmu_gather.c:262 [inline] tlb_finish_mmu+0x147/0x7e0 mm/mmu_gather.c:353 exit_mmap+0x1fe/0x720 mm/mmap.c:3212 __mmput+0x128/0x4c0 kernel/fork.c:1180 mmput+0x5c/0x70 kernel/fork.c:1201 exit_mm kernel/exit.c:510 [inline] do_exit+0xa09/0x29f0 kernel/exit.c:782 do_group_exit+0xd2/0x2f0 kernel/exit.c:925 get_signal+0x2542/0x2600 kernel/signal.c:2857 arch_do_signal_or_restart+0x82/0x2300 arch/x86/kernel/signal.c:869 exit_to_user_mode_loop kernel/entry/common.c:166 [inline] exit_to_user_mode_prepare+0x15f/0x250 kernel/entry/common.c:201 __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline] syscall_exit_to_user_mode+0x19/0x50 kernel/entry/common.c:294 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Memory state around the buggy address: ffff888022ca8580: fa fb fc fc fa fb fc fc fa fb fc fc 00 00 fc fc ffff888022ca8600: fa fb fc fc fa fb fc fc fa fb fc fc fb fb fc fc >ffff888022ca8680: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc ^ ffff888022ca8700: fa fb fc fc fa fb fc fc fb fb fc fc fa fb fc fc ffff888022ca8780: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc ==================================================================