================================================================== BUG: KASAN: use-after-free in inet_ctl_sock_destroy include/net/inet_common.h:65 [inline] BUG: KASAN: use-after-free in tcp_sk_exit+0x2a4/0x2e0 net/ipv4/tcp_ipv4.c:2868 Read of size 8 at addr ffff888070ce3540 by task syz-executor.5/8533 CPU: 1 PID: 8533 Comm: syz-executor.5 Not tainted 5.14.0-rc4-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233 __kasan_report mm/kasan/report.c:419 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:436 inet_ctl_sock_destroy include/net/inet_common.h:65 [inline] tcp_sk_exit+0x2a4/0x2e0 net/ipv4/tcp_ipv4.c:2868 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:175 setup_net+0x639/0xa30 net/core/net_namespace.c:356 copy_net_ns+0x319/0x760 net/core/net_namespace.c:474 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3002 __do_sys_unshare kernel/fork.c:3076 [inline] __se_sys_unshare kernel/fork.c:3074 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3074 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+0x44/0xae RIP: 0033:0x4665e9 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f5c91595188 EFLAGS: 00000246 ORIG_RAX: 0000000000000110 RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665e9 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 000000006c060000 RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80 R13: 0000000000a9fb1f R14: 00007f5c91595300 R15: 0000000000022000 Allocated by task 8533: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x84/0xa0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:2956 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc+0x285/0x4a0 mm/slub.c:2969 sk_prot_alloc+0x5f/0x290 net/core/sock.c:1802 sk_alloc+0x32/0xbc0 net/core/sock.c:1861 inet6_create net/ipv6/af_inet6.c:183 [inline] inet6_create+0x36f/0x1030 net/ipv6/af_inet6.c:110 __sock_create+0x353/0x790 net/socket.c:1450 inet_ctl_sock_create+0x88/0x1d0 net/ipv4/af_inet.c:1654 icmpv6_sk_init net/ipv6/icmp.c:1052 [inline] icmpv6_sk_init+0xfa/0x2d0 net/ipv6/icmp.c:1042 ops_init+0xaf/0x470 net/core/net_namespace.c:140 setup_net+0x40f/0xa30 net/core/net_namespace.c:333 copy_net_ns+0x319/0x760 net/core/net_namespace.c:474 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3002 __do_sys_unshare kernel/fork.c:3076 [inline] __se_sys_unshare kernel/fork.c:3074 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3074 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+0x44/0xae Freed by task 8533: kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1625 [inline] slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1650 slab_free mm/slub.c:3210 [inline] kmem_cache_free+0x8a/0x5b0 mm/slub.c:3226 sk_prot_free net/core/sock.c:1842 [inline] __sk_destruct+0x5a2/0x900 net/core/sock.c:1929 sk_destruct+0xbd/0xe0 net/core/sock.c:1944 __sk_free+0xef/0x3d0 net/core/sock.c:1955 sk_free net/core/sock.c:1966 [inline] sock_put include/net/sock.h:1816 [inline] sk_common_release+0x292/0x390 net/core/sock.c:3399 inet_release+0x12e/0x280 net/ipv4/af_inet.c:431 inet6_release+0x4c/0x70 net/ipv6/af_inet6.c:478 __sock_release net/socket.c:648 [inline] sock_release+0x87/0x1b0 net/socket.c:676 inet_ctl_sock_destroy include/net/inet_common.h:65 [inline] icmpv6_sk_exit+0x14c/0x240 net/ipv6/icmp.c:1038 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:175 setup_net+0x639/0xa30 net/core/net_namespace.c:356 copy_net_ns+0x319/0x760 net/core/net_namespace.c:474 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 unshare_nsproxy_namespaces+0xc1/0x1f0 kernel/nsproxy.c:226 ksys_unshare+0x445/0x920 kernel/fork.c:3002 __do_sys_unshare kernel/fork.c:3076 [inline] __se_sys_unshare kernel/fork.c:3074 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3074 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+0x44/0xae The buggy address belongs to the object at ffff888070ce3100 which belongs to the cache RAWv6 of size 1632 The buggy address is located 1088 bytes inside of 1632-byte region [ffff888070ce3100, ffff888070ce3760) The buggy address belongs to the page: page:ffffea0001c33800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x70ce0 head:ffffea0001c33800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0002bde000 0000000400000004 ffff888147816b40 raw: 0000000000000000 0000000000120012 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 7426, ts 675906178262, free_ts 675875880079 prep_new_page mm/page_alloc.c:2436 [inline] get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4169 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5391 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2244 alloc_slab_page mm/slub.c:1688 [inline] allocate_slab+0x32e/0x4b0 mm/slub.c:1828 new_slab mm/slub.c:1891 [inline] new_slab_objects mm/slub.c:2637 [inline] ___slab_alloc+0x4ba/0x820 mm/slub.c:2800 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2840 slab_alloc_node mm/slub.c:2922 [inline] slab_alloc mm/slub.c:2964 [inline] kmem_cache_alloc+0x3e1/0x4a0 mm/slub.c:2969 sk_prot_alloc+0x5f/0x290 net/core/sock.c:1802 sk_alloc+0x32/0xbc0 net/core/sock.c:1861 inet6_create net/ipv6/af_inet6.c:183 [inline] inet6_create+0x36f/0x1030 net/ipv6/af_inet6.c:110 __sock_create+0x353/0x790 net/socket.c:1450 inet_ctl_sock_create+0x88/0x1d0 net/ipv4/af_inet.c:1654 ops_init+0xaf/0x470 net/core/net_namespace.c:140 setup_net+0x40f/0xa30 net/core/net_namespace.c:333 copy_net_ns+0x319/0x760 net/core/net_namespace.c:474 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1346 [inline] free_pcp_prepare+0x2c5/0x780 mm/page_alloc.c:1397 free_unref_page_prepare mm/page_alloc.c:3332 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3411 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x8e/0xa0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc_node mm/slub.c:2956 [inline] slab_alloc mm/slub.c:2964 [inline] __kmalloc+0x1f4/0x330 mm/slub.c:4108 kmalloc include/linux/slab.h:596 [inline] tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_number_perm+0x1d5/0x590 security/tomoyo/file.c:723 security_path_chmod+0xe0/0x150 security/security.c:1205 chmod_common+0x156/0x440 fs/open.c:580 vfs_fchmod fs/open.c:601 [inline] __do_sys_fchmod fs/open.c:610 [inline] __se_sys_fchmod fs/open.c:604 [inline] __x64_sys_fchmod+0x10e/0x190 fs/open.c:604 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+0x44/0xae Memory state around the buggy address: ffff888070ce3400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888070ce3480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888070ce3500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888070ce3580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888070ce3600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================