================================================================== BUG: KASAN: double-free in inet_sock_destruct+0x597/0x830 net/ipv4/af_inet.c:159 Free of addr ffff888037f47e80 by task swapper/3/0 CPU: 3 UID: 0 PID: 0 Comm: swapper/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 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_invalid_free+0xb8/0xe0 mm/kasan/report.c:557 check_slab_allocation+0xc3/0xf0 mm/kasan/common.c:234 kasan_slab_pre_free include/linux/kasan.h:198 [inline] slab_free_hook mm/slub.c:2485 [inline] slab_free mm/slub.c:6668 [inline] kfree+0x21d/0x6e0 mm/slub.c:6876 inet_sock_destruct+0x597/0x830 net/ipv4/af_inet.c:159 __sk_destruct+0x85/0xbc0 net/core/sock.c:2350 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] sctp_endpoint_destroy_rcu+0xd3/0x100 net/sctp/endpointola.c:197 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0x79c/0x15f0 kernel/rcu/tree.c:2857 handle_softirqs+0x219/0x950 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 RIP: 0010:pv_native_safe_halt+0xf/0x20 arch/x86/kernel/paravirt.c:82 Code: 46 60 02 c3 cc cc cc cc 0f 1f 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 f3 0f 1e fa eb 07 0f 00 2d 13 f9 12 00 fb f4 cc 35 03 00 66 2e 0f 1f 84 00 00 00 00 00 66 90 90 90 90 90 90 RSP: 0018:ffffc90000197de8 EFLAGS: 00000286 RAX: 000000000029dced RBX: 0000000000000003 RCX: ffffffff8b7766d9 RDX: 0000000000000000 RSI: ffffffff8dacb6f9 RDI: ffffffff8bf2a580 RBP: ffffed1003bdf000 R08: 0000000000000001 R09: ffffed100d4e673d R10: ffff88806a7339eb R11: ffff88801def8b30 R12: 0000000000000003 R13: ffff88801def8000 R14: ffffffff908878d0 R15: 0000000000000000 arch_safe_halt arch/x86/include/asm/paravirt.h:107 [inline] default_idle+0x13/0x20 arch/x86/kernel/process.c:767 default_idle_call+0x6c/0xb0 kernel/sched/idle.c:122 cpuidle_idle_call kernel/sched/idle.c:191 [inline] do_idle+0x38d/0x510 kernel/sched/idle.c:332 cpu_startup_entry+0x4f/0x60 kernel/sched/idle.c:430 start_secondary+0x21d/0x2d0 arch/x86/kernel/smpboot.c:312 common_startup_64+0x13e/0x148 Allocated by task 6893: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:397 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:414 kasan_kmalloc include/linux/kasan.h:262 [inline] __do_kmalloc_node mm/slub.c:5657 [inline] __kmalloc_noprof+0x33d/0x910 mm/slub.c:5669 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] cipso_v4_sock_setattr+0xbb/0x4c0 net/ipv4/cipso_ipv4.c:1890 netlbl_conn_setattr+0x4b8/0x620 net/netlabel/netlabel_kapi.c:1152 selinux_netlbl_socket_connect_helper security/selinux/netlabel.c:569 [inline] selinux_netlbl_socket_connect_locked+0x14d/0x220 security/selinux/netlabel.c:597 selinux_netlbl_socket_connect+0x26/0x40 security/selinux/netlabel.c:615 selinux_socket_connect+0x64/0x80 security/selinux/hooks.c:5119 security_socket_connect+0xc6/0x240 security/security.c:4165 __sys_connect_file+0x8f/0x1a0 net/socket.c:2085 __sys_connect+0x13b/0x160 net/socket.c:2108 __do_sys_connect net/socket.c:2114 [inline] __se_sys_connect net/socket.c:2111 [inline] __x64_sys_connect+0x72/0xb0 net/socket.c:2111 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 0: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6668 [inline] kfree+0x2f8/0x6e0 mm/slub.c:6876 inet_sock_destruct+0x597/0x830 net/ipv4/af_inet.c:159 __sk_destruct+0x85/0xbc0 net/core/sock.c:2350 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] sctp_endpoint_destroy_rcu+0xd3/0x100 net/sctp/endpointola.c:197 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0x79c/0x15f0 kernel/rcu/tree.c:2857 handle_softirqs+0x219/0x950 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 The buggy address belongs to the object at ffff888037f47e80 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff888037f47e80, ffff888037f47ec0) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x37f47 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b4428c0 ffffea0000a5da80 dead000000000004 raw: 0000000000000000 0000000000200020 00000000f5000000 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 0x252800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP|__GFP_THISNODE), pid 6616, tgid 6615 (syz.2.323), ts 73432904366, free_ts 73394484332 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_slab_page mm/slub.c:3077 [inline] allocate_slab mm/slub.c:3248 [inline] new_slab+0xaf/0x430 mm/slub.c:3302 ___slab_alloc+0xe18/0x1c90 mm/slub.c:4656 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __do_kmalloc_node mm/slub.c:5656 [inline] __kmalloc_node_noprof+0x4d8/0x930 mm/slub.c:5663 kmalloc_array_node_noprof include/linux/slab.h:1075 [inline] alloc_slab_obj_exts+0x43/0xf0 mm/slub.c:2123 account_slab mm/slub.c:3202 [inline] allocate_slab mm/slub.c:3267 [inline] new_slab+0x353/0x430 mm/slub.c:3302 ___slab_alloc+0xe18/0x1c90 mm/slub.c:4656 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __kmalloc_cache_noprof+0x485/0x800 mm/slub.c:5771 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] copy_verifier_state+0xc1b/0x1030 kernel/bpf/verifier.c:1773 is_state_visited kernel/bpf/verifier.c:20041 [inline] do_check kernel/bpf/verifier.c:20511 [inline] do_check_common+0x5859/0xc640 kernel/bpf/verifier.c:23865 do_check_main kernel/bpf/verifier.c:23948 [inline] bpf_check+0x8b63/0xcb70 kernel/bpf/verifier.c:25255 bpf_prog_load+0x114e/0x2cc0 kernel/bpf/syscall.c:3088 page last free pid 6627 tgid 6627 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 __pagetable_free include/linux/mm.h:3200 [inline] pagetable_free include/linux/mm.h:3224 [inline] pagetable_dtor_free include/linux/mm.h:3328 [inline] __tlb_remove_table include/asm-generic/tlb.h:220 [inline] __tlb_remove_table_free mm/mmu_gather.c:227 [inline] tlb_remove_table_rcu+0x2b2/0x390 mm/mmu_gather.c:290 rcu_do_batch kernel/rcu/tree.c:2605 [inline] rcu_core+0x79c/0x15f0 kernel/rcu/tree.c:2857 handle_softirqs+0x219/0x950 kernel/softirq.c:622 __do_softirq kernel/softirq.c:656 [inline] invoke_softirq kernel/softirq.c:496 [inline] __irq_exit_rcu+0x109/0x170 kernel/softirq.c:723 irq_exit_rcu+0x9/0x30 kernel/softirq.c:739 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1056 [inline] sysvec_apic_timer_interrupt+0xa4/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 Memory state around the buggy address: ffff888037f47d80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff888037f47e00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff888037f47e80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff888037f47f00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc ffff888037f47f80: 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 46 60 rex.RX (bad) 2: 02 c3 add %bl,%al 4: cc int3 5: cc int3 6: cc int3 7: cc int3 8: 0f 1f 00 nopl (%rax) b: 90 nop c: 90 nop d: 90 nop e: 90 nop f: 90 nop 10: 90 nop 11: 90 nop 12: 90 nop 13: 90 nop 14: 90 nop 15: 90 nop 16: 90 nop 17: 90 nop 18: 90 nop 19: 90 nop 1a: 90 nop 1b: f3 0f 1e fa endbr64 1f: eb 07 jmp 0x28 21: 0f 00 2d 13 f9 12 00 verw 0x12f913(%rip) # 0x12f93b 28: fb sti 29: f4 hlt * 2a: e9 cc 35 03 00 jmp 0x335fb <-- trapping instruction 2f: 66 2e 0f 1f 84 00 00 cs nopw 0x0(%rax,%rax,1) 36: 00 00 00 39: 66 90 xchg %ax,%ax 3b: 90 nop 3c: 90 nop 3d: 90 nop 3e: 90 nop 3f: 90 nop