================================================================== BUG: KASAN: use-after-free in tcp_or_dccp_get_hashinfo include/net/inet_hashtables.h:181 [inline] BUG: KASAN: use-after-free in reqsk_queue_unlink+0x320/0x350 net/ipv4/inet_connection_sock.c:913 Read of size 8 at addr ffff88804c620500 by task kworker/u4:7/11959 CPU: 1 PID: 11959 Comm: kworker/u4:7 Not tainted 6.1.0-rc4-syzkaller-00159-g4bbf3422df78 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022 Workqueue: bat_events batadv_nc_worker 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:284 [inline] print_report+0x15e/0x45d mm/kasan/report.c:395 kasan_report+0xbb/0x1f0 mm/kasan/report.c:495 tcp_or_dccp_get_hashinfo include/net/inet_hashtables.h:181 [inline] reqsk_queue_unlink+0x320/0x350 net/ipv4/inet_connection_sock.c:913 inet_csk_reqsk_queue_drop net/ipv4/inet_connection_sock.c:927 [inline] inet_csk_reqsk_queue_drop_and_put net/ipv4/inet_connection_sock.c:939 [inline] reqsk_timer_handler+0x724/0x1160 net/ipv4/inet_connection_sock.c:1053 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1519 [inline] __run_timers.part.0+0x6a2/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1803 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 invoke_softirq kernel/softirq.c:445 [inline] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650 irq_exit_rcu+0x5/0x20 kernel/softirq.c:662 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1107 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:649 RIP: 0010:lock_release+0x41/0x810 kernel/locking/lockdep.c:5676 Code: 48 81 ec 90 00 00 00 48 8d 6c 24 10 48 89 74 24 08 48 c7 44 24 10 b3 8a b5 41 48 c1 ed 03 48 c7 44 24 18 c0 cf 79 8b 48 01 e8 <48> c7 44 24 20 b0 c0 5f 81 c7 00 f1 f1 f1 f1 c7 40 04 f1 f1 04 f2 RSP: 0018:ffffc9000eaafbc0 EFLAGS: 00000282 RAX: fffff52001d55f7a RBX: 0000000000000001 RCX: 0000000000000000 RDX: ffff88801dc51d40 RSI: ffffffff891fa6e9 RDI: ffffffff8bf88ac0 RBP: 1ffff92001d55f7a R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000000 R12: ffffffff8bf88ac0 R13: 0000000000000000 R14: dffffc0000000000 R15: 0000000000000227 rcu_lock_release include/linux/rcupdate.h:309 [inline] rcu_read_unlock include/linux/rcupdate.h:771 [inline] batadv_nc_purge_orig_hash net/batman-adv/network-coding.c:412 [inline] batadv_nc_worker+0x86b/0xfa0 net/batman-adv/network-coding.c:719 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Allocated by task 3636: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 __kasan_slab_alloc+0x7e/0x80 mm/kasan/common.c:325 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:737 [inline] slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x2ac/0x3c0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:679 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:465 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:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3257 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+0x63/0xcd Freed by task 16791: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 kasan_set_track+0x21/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2a/0x40 mm/kasan/generic.c:511 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free+0x160/0x1c0 mm/kasan/common.c:200 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0xea/0x5b0 mm/slub.c:3683 net_free net/core/net_namespace.c:439 [inline] net_free net/core/net_namespace.c:435 [inline] cleanup_net+0x8ba/0xb00 net/core/net_namespace.c:622 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x665/0x1080 kernel/workqueue.c:2436 kthread+0x2e4/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0x152/0x1d0 kernel/time/timer.c:1805 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:45 __kasan_record_aux_stack+0xbc/0xd0 mm/kasan/generic.c:481 insert_work+0x48/0x350 kernel/workqueue.c:1358 __queue_work+0x693/0x13b0 kernel/workqueue.c:1517 call_timer_fn+0x1da/0x7c0 kernel/time/timer.c:1474 expire_timers kernel/time/timer.c:1514 [inline] __run_timers.part.0+0x4a3/0xaf0 kernel/time/timer.c:1790 __run_timers kernel/time/timer.c:1768 [inline] run_timer_softirq+0x152/0x1d0 kernel/time/timer.c:1805 __do_softirq+0x1f7/0xad8 kernel/softirq.c:571 The buggy address belongs to the object at ffff88804c620000 which belongs to the cache net_namespace of size 6976 The buggy address is located 1280 bytes inside of 6976-byte region [ffff88804c620000, ffff88804c621b40) The buggy address belongs to the physical page: page:ffffea0001318800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88804c623880 pfn:0x4c620 head:ffffea0001318800 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88806f8c5981 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00010d3808 ffffea000148ce08 ffff8880119d6500 raw: ffff88804c623880 0000000000040002 00000001ffffffff ffff88806f8c5981 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 3636, tgid 3636 (syz-executor.5), ts 182845397988, free_ts 11954287820 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x10b5/0x2d50 mm/page_alloc.c:4288 __alloc_pages+0x1c7/0x5a0 mm/page_alloc.c:5555 alloc_pages+0x1a6/0x270 mm/mempolicy.c:2285 alloc_slab_page mm/slub.c:1794 [inline] allocate_slab+0x213/0x300 mm/slub.c:1939 new_slab mm/slub.c:1992 [inline] ___slab_alloc+0xa91/0x1400 mm/slub.c:3180 __slab_alloc.constprop.0+0x56/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x312/0x3c0 mm/slub.c:3422 kmem_cache_zalloc include/linux/slab.h:679 [inline] net_alloc net/core/net_namespace.c:410 [inline] copy_net_ns+0x125/0x760 net/core/net_namespace.c:465 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:3188 __do_sys_unshare kernel/fork.c:3259 [inline] __se_sys_unshare kernel/fork.c:3257 [inline] __x64_sys_unshare+0x2d/0x40 kernel/fork.c:3257 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+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare+0x65c/0xd90 mm/page_alloc.c:1509 free_unref_page_prepare mm/page_alloc.c:3387 [inline] free_unref_page+0x19/0x4d0 mm/page_alloc.c:3483 free_contig_range+0xb1/0x180 mm/page_alloc.c:9493 destroy_args+0xa8/0x64c mm/debug_vm_pgtable.c:1031 debug_vm_pgtable+0x2954/0x29e5 mm/debug_vm_pgtable.c:1354 do_one_initcall+0x13d/0x780 init/main.c:1303 do_initcall_level init/main.c:1376 [inline] do_initcalls init/main.c:1392 [inline] do_basic_setup init/main.c:1411 [inline] kernel_init_freeable+0x6ff/0x788 init/main.c:1631 kernel_init+0x1a/0x1d0 init/main.c:1519 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Memory state around the buggy address: ffff88804c620400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804c620480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88804c620500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88804c620580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88804c620600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 48 81 ec 90 00 00 00 sub $0x90,%rsp 7: 48 8d 6c 24 10 lea 0x10(%rsp),%rbp c: 48 89 74 24 08 mov %rsi,0x8(%rsp) 11: 48 c7 44 24 10 b3 8a movq $0x41b58ab3,0x10(%rsp) 18: b5 41 1a: 48 c1 ed 03 shr $0x3,%rbp 1e: 48 c7 44 24 18 c0 cf movq $0xffffffff8b79cfc0,0x18(%rsp) 25: 79 8b 27: 48 01 e8 add %rbp,%rax * 2a: 48 c7 44 24 20 b0 c0 movq $0xffffffff815fc0b0,0x20(%rsp) <-- trapping instruction 31: 5f 81 33: c7 00 f1 f1 f1 f1 movl $0xf1f1f1f1,(%rax) 39: c7 40 04 f1 f1 04 f2 movl $0xf204f1f1,0x4(%rax)