================================================================== BUG: KASAN: double-free in inet_sock_destruct+0x597/0x830 net/ipv4/af_inet.c:159 Free of addr ffff8880284e7a00 by task syz.8.15778/17442 CPU: 1 UID: 0 PID: 17442 Comm: syz.8.15778 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+0x57/0xc0 arch/x86/kernel/apic/apic.c:1056 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:697 RIP: 0033:0x7f39dda4d728 Code: 40 00 41 89 fb 44 8d 56 04 4c 8d 0d f2 48 38 00 89 f0 4c 8d 05 e9 28 38 00 89 c2 81 e2 ff 1f 00 00 49 8b 0c d1 48 39 f1 74 28 <48> 85 c9 74 29 45 38 1c 10 75 23 83 c0 01 44 39 d0 75 dc 48 89 f0 RSP: 002b:00007fff15739208 EFLAGS: 00000287 RAX: 000000008ab58b25 RBX: 00007f39de915720 RCX: ffffffff81bb8b25 RDX: 0000000000000b25 RSI: ffffffff8ab58b25 RDI: 0000000000000001 RBP: ffffffff8ab58b25 R08: 00007f39dddd0000 R09: 00007f39dddd2000 R10: 000000008ab58b29 R11: 0000000000000001 R12: 0000000000000001 R13: 0000000000000000 R14: ffffffff8ab58b25 R15: 000000000001032f Allocated by task 17440: 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 17442: 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+0x57/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 ffff8880284e7a00 which belongs to the cache kmalloc-64 of size 64 The buggy address is located 0 bytes inside of 64-byte region [ffff8880284e7a00, ffff8880284e7a40) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x284e7 ksm flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000000 ffff88801b4428c0 ffffea0000ced7c0 dead000000000003 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 0x52c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5345, tgid 5345 (udevadm), ts 26750940177, free_ts 26750878105 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_slab_page mm/slub.c:3075 [inline] allocate_slab mm/slub.c:3248 [inline] new_slab+0x2c3/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_noprof+0x4fc/0x910 mm/slub.c:5669 kmalloc_noprof include/linux/slab.h:961 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] tomoyo_encode2+0x100/0x3e0 security/tomoyo/realpath.c:45 tomoyo_encode+0x29/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x18f/0x6e0 security/tomoyo/realpath.c:283 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x274/0x460 security/tomoyo/file.c:822 security_inode_getattr+0x116/0x290 security/security.c:1869 vfs_getattr fs/stat.c:259 [inline] vfs_statx_path fs/stat.c:299 [inline] vfs_statx+0x121/0x3f0 fs/stat.c:356 vfs_fstatat+0x7b/0xf0 fs/stat.c:375 __do_sys_newfstatat+0x97/0x120 fs/stat.c:542 page last free pid 5345 tgid 5345 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 selinux_genfs_get_sid security/selinux/hooks.c:1359 [inline] inode_doinit_with_dentry+0xaca/0x12e0 security/selinux/hooks.c:1557 selinux_d_instantiate+0x26/0x30 security/selinux/hooks.c:6545 security_d_instantiate+0x142/0x1a0 security/security.c:3601 d_splice_alias_ops+0x92/0x840 fs/dcache.c:3064 kernfs_iop_lookup+0x23f/0x2d0 fs/kernfs/dir.c:1254 __lookup_slow+0x251/0x460 fs/namei.c:1858 lookup_slow+0x50/0x70 fs/namei.c:1875 walk_component fs/namei.c:2221 [inline] lookup_last fs/namei.c:2722 [inline] path_lookupat+0x5e9/0xc40 fs/namei.c:2746 filename_lookup+0x224/0x5f0 fs/namei.c:2775 do_readlinkat+0xce/0x3a0 fs/stat.c:576 __do_sys_readlink fs/stat.c:613 [inline] __se_sys_readlink fs/stat.c:610 [inline] __x64_sys_readlink+0x78/0xc0 fs/stat.c:610 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 Memory state around the buggy address: ffff8880284e7900: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880284e7980: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff8880284e7a00: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ^ ffff8880284e7a80: fa fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc ffff8880284e7b00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc ==================================================================