================================================================== BUG: KASAN: use-after-free in atomic_try_cmpxchg include/asm-generic/atomic-instrumented.h:693 [inline] BUG: KASAN: use-after-free in queued_write_lock include/asm-generic/qrwlock.h:92 [inline] BUG: KASAN: use-after-free in __raw_write_lock_bh include/linux/rwlock_api_smp.h:204 [inline] BUG: KASAN: use-after-free in _raw_write_lock_bh+0x81/0xe0 kernel/locking/spinlock.c:319 Write of size 4 at addr ffff8881e496b6a0 by task syz.4.867/3314 CPU: 1 PID: 3314 Comm: syz.4.867 Not tainted 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack+0x1e/0x20 lib/dump_stack.c:77 dump_stack+0x15b/0x1b8 lib/dump_stack.c:118 print_address_description+0x8d/0x4c0 mm/kasan/report.c:384 __kasan_report+0xef/0x120 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 check_memory_region_inline mm/kasan/generic.c:141 [inline] check_memory_region+0x274/0x280 mm/kasan/generic.c:191 __kasan_check_write+0x14/0x20 mm/kasan/common.c:99 atomic_try_cmpxchg include/asm-generic/atomic-instrumented.h:693 [inline] queued_write_lock include/asm-generic/qrwlock.h:92 [inline] __raw_write_lock_bh include/linux/rwlock_api_smp.h:204 [inline] _raw_write_lock_bh+0x81/0xe0 kernel/locking/spinlock.c:319 reuseport_array_free+0xbd/0x1b0 kernel/bpf/reuseport_array.c:130 map_create+0x433/0x980 kernel/bpf/syscall.c:639 __do_sys_bpf kernel/bpf/syscall.c:2873 [inline] __se_sys_bpf+0x2dc/0x570 kernel/bpf/syscall.c:2849 __x64_sys_bpf+0x7b/0x90 kernel/bpf/syscall.c:2849 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f516ff62969 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f516e5cb038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f5170189fa0 RCX: 00007f516ff62969 RDX: 0000000000000050 RSI: 0000200000000300 RDI: 0000000000000000 RBP: 00007f516ffe4ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f5170189fa0 R15: 00007fff8ca29688 Allocated by task 3002: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x162/0x200 mm/kasan/common.c:529 kasan_slab_alloc+0x12/0x20 mm/kasan/common.c:537 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xe2/0x270 mm/slub.c:2842 kmem_cache_zalloc include/linux/slab.h:680 [inline] net_alloc net/core/net_namespace.c:424 [inline] copy_net_ns+0x13f/0x520 net/core/net_namespace.c:476 create_new_namespaces+0x49c/0x590 kernel/nsproxy.c:103 copy_namespaces+0x17e/0x1c0 kernel/nsproxy.c:161 copy_process+0x1194/0x2cf0 kernel/fork.c:2055 _do_fork+0x190/0x860 kernel/fork.c:2399 __do_sys_clone kernel/fork.c:2557 [inline] __se_sys_clone kernel/fork.c:2538 [inline] __x64_sys_clone+0x12e/0x160 kernel/fork.c:2538 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 Freed by task 3002: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x1c3/0x280 mm/kasan/common.c:487 kasan_slab_free+0xe/0x10 mm/kasan/common.c:496 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook+0xb7/0x180 mm/slub.c:1494 slab_free mm/slub.c:3080 [inline] kmem_cache_free+0x10c/0x2c0 mm/slub.c:3096 net_free net/core/net_namespace.c:452 [inline] net_drop_ns net/core/net_namespace.c:459 [inline] copy_net_ns+0x42a/0x520 net/core/net_namespace.c:499 create_new_namespaces+0x49c/0x590 kernel/nsproxy.c:103 copy_namespaces+0x17e/0x1c0 kernel/nsproxy.c:161 copy_process+0x1194/0x2cf0 kernel/fork.c:2055 _do_fork+0x190/0x860 kernel/fork.c:2399 __do_sys_clone kernel/fork.c:2557 [inline] __se_sys_clone kernel/fork.c:2538 [inline] __x64_sys_clone+0x12e/0x160 kernel/fork.c:2538 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 The buggy address belongs to the object at ffff8881e496b600 which belongs to the cache net_namespace of size 4352 The buggy address is located 160 bytes inside of 4352-byte region [ffff8881e496b600, ffff8881e496c700) The buggy address belongs to the page: page:ffffea0007925a00 refcount:1 mapcount:0 mapping:ffff8881f5d02f00 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5d02f00 raw: 0000000000000000 0000000000070007 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x35e/0x370 mm/page_alloc.c:2171 get_page_from_freelist+0x1296/0x1310 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x202/0x4b0 mm/page_alloc.c:4894 alloc_slab_page+0x3c/0x3b0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x93/0x420 mm/slub.c:1749 new_slab_objects mm/slub.c:2505 [inline] ___slab_alloc+0x29e/0x420 mm/slub.c:2667 __slab_alloc+0x63/0xa0 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0x12c/0x270 mm/slub.c:2842 kmem_cache_zalloc include/linux/slab.h:680 [inline] net_alloc net/core/net_namespace.c:424 [inline] copy_net_ns+0x13f/0x520 net/core/net_namespace.c:476 create_new_namespaces+0x49c/0x590 kernel/nsproxy.c:103 copy_namespaces+0x17e/0x1c0 kernel/nsproxy.c:161 copy_process+0x1194/0x2cf0 kernel/fork.c:2055 _do_fork+0x190/0x860 kernel/fork.c:2399 __do_sys_clone kernel/fork.c:2557 [inline] __se_sys_clone kernel/fork.c:2538 [inline] __x64_sys_clone+0x12e/0x160 kernel/fork.c:2538 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1176 [inline] __free_pages_ok+0x7e4/0x910 mm/page_alloc.c:1438 free_the_page mm/page_alloc.c:4956 [inline] __free_pages+0x8c/0x110 mm/page_alloc.c:4962 __free_slab+0x218/0x2d0 mm/slub.c:1774 free_slab mm/slub.c:1789 [inline] discard_slab mm/slub.c:1795 [inline] unfreeze_partials+0x165/0x1a0 mm/slub.c:2288 put_cpu_partial+0xc1/0x180 mm/slub.c:2324 __slab_free+0x2be/0x380 mm/slub.c:2971 do_slab_free mm/slub.c:3068 [inline] ___cache_free+0xbb/0xd0 mm/slub.c:3087 qlink_free+0x23/0x30 mm/kasan/quarantine.c:148 qlist_free_all+0x5f/0xb0 mm/kasan/quarantine.c:167 quarantine_reduce+0x1a8/0x200 mm/kasan/quarantine.c:260 __kasan_kmalloc+0x42/0x200 mm/kasan/common.c:507 kasan_slab_alloc+0x12/0x20 mm/kasan/common.c:537 slab_post_alloc_hook mm/slab.h:584 [inline] slab_alloc_node mm/slub.c:2829 [inline] slab_alloc mm/slub.c:2837 [inline] kmem_cache_alloc+0xe2/0x270 mm/slub.c:2842 getname_flags+0xb9/0x500 fs/namei.c:141 user_path_at_empty+0x2f/0x50 fs/namei.c:2703 do_readlinkat+0xd4/0x480 fs/stat.c:398 Memory state around the buggy address: ffff8881e496b580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881e496b600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881e496b680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881e496b700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881e496b780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ================================================================================ UBSAN: array-index-out-of-bounds in kernel/locking/qspinlock.c:129:9 index 16382 is out of range for type 'unsigned long[8]' CPU: 1 PID: 3314 Comm: syz.4.867 Tainted: G B 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack+0x1e/0x20 lib/dump_stack.c:77 dump_stack+0x15b/0x1b8 lib/dump_stack.c:118 ubsan_epilogue+0xf/0x60 lib/ubsan.c:148 __ubsan_handle_out_of_bounds+0xdf/0xf0 lib/ubsan.c:356 decode_tail kernel/locking/qspinlock.c:129 [inline] __pv_queued_spin_lock_slowpath+0xaec/0xb70 kernel/locking/qspinlock.c:467 pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:642 [inline] queued_spin_lock_slowpath+0x47/0x50 arch/x86/include/asm/qspinlock.h:50 queued_spin_lock include/asm-generic/qspinlock.h:81 [inline] queued_write_lock_slowpath+0x1fc/0x230 kernel/locking/qrwlock.c:67 queued_write_lock include/asm-generic/qrwlock.h:95 [inline] __raw_write_lock_bh include/linux/rwlock_api_smp.h:204 [inline] _raw_write_lock_bh+0xd6/0xe0 kernel/locking/spinlock.c:319 reuseport_array_free+0xbd/0x1b0 kernel/bpf/reuseport_array.c:130 map_create+0x433/0x980 kernel/bpf/syscall.c:639 __do_sys_bpf kernel/bpf/syscall.c:2873 [inline] __se_sys_bpf+0x2dc/0x570 kernel/bpf/syscall.c:2849 __x64_sys_bpf+0x7b/0x90 kernel/bpf/syscall.c:2849 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f516ff62969 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f516e5cb038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f5170189fa0 RCX: 00007f516ff62969 RDX: 0000000000000050 RSI: 0000200000000300 RDI: 0000000000000000 RBP: 00007f516ffe4ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f5170189fa0 R15: 00007fff8ca29688 ================================================================================ kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#2] PREEMPT SMP KASAN CPU: 1 PID: 3314 Comm: syz.4.867 Tainted: G B D 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:__write_once_size include/linux/compiler.h:295 [inline] RIP: 0010:__pv_queued_spin_lock_slowpath+0x2c8/0xb70 kernel/locking/qspinlock.c:470 Code: 00 74 18 49 89 d7 48 89 d7 e8 a4 39 45 00 48 be 00 00 00 00 00 fc ff df 4c 89 fa 4c 8b 7c 24 10 4c 03 3a 4c 89 f8 48 c1 e8 03 <80> 3c 30 00 74 08 4c 89 ff e8 1a 3a 45 00 48 8b 44 24 20 49 89 07 RSP: 0018:ffff8881ce3a7a80 EFLAGS: 00010206 RAX: 000000000000b114 RBX: ffff8881e496b6a4 RCX: 00000000000588a0 RDX: ffffffff85457f00 RSI: dffffc0000000000 RDI: 0000000000080000 RBP: ffff8881ce3a7b70 R08: 0000000000000004 R09: 0000000000000003 R10: ffffed1039c74eac R11: 1ffff11039c74eac R12: 1ffff1103edeb109 R13: 1ffff1103c92d6d4 R14: ffff8881f6f58854 R15: 00000000000588a0 FS: 00007f516e5cb6c0(0000) GS:ffff8881f6f00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f3a83c3cbac CR3: 00000001e6a2f000 CR4: 00000000003406a0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff1 DR7: 0000000000000600 Call Trace: pv_queued_spin_lock_slowpath arch/x86/include/asm/paravirt.h:642 [inline] queued_spin_lock_slowpath+0x47/0x50 arch/x86/include/asm/qspinlock.h:50 queued_spin_lock include/asm-generic/qspinlock.h:81 [inline] queued_write_lock_slowpath+0x1fc/0x230 kernel/locking/qrwlock.c:67 queued_write_lock include/asm-generic/qrwlock.h:95 [inline] __raw_write_lock_bh include/linux/rwlock_api_smp.h:204 [inline] _raw_write_lock_bh+0xd6/0xe0 kernel/locking/spinlock.c:319 reuseport_array_free+0xbd/0x1b0 kernel/bpf/reuseport_array.c:130 map_create+0x433/0x980 kernel/bpf/syscall.c:639 __do_sys_bpf kernel/bpf/syscall.c:2873 [inline] __se_sys_bpf+0x2dc/0x570 kernel/bpf/syscall.c:2849 __x64_sys_bpf+0x7b/0x90 kernel/bpf/syscall.c:2849 do_syscall_64+0xcf/0x170 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f516ff62969 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f516e5cb038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffda RBX: 00007f5170189fa0 RCX: 00007f516ff62969 RDX: 0000000000000050 RSI: 0000200000000300 RDI: 0000000000000000 RBP: 00007f516ffe4ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f5170189fa0 R15: 00007fff8ca29688 Modules linked in: ---------------- Code disassembly (best guess): 0: 00 74 18 49 add %dh,0x49(%rax,%rbx,1) 4: 89 d7 mov %edx,%edi 6: 48 89 d7 mov %rdx,%rdi 9: e8 a4 39 45 00 call 0x4539b2 e: 48 be 00 00 00 00 00 movabs $0xdffffc0000000000,%rsi 15: fc ff df 18: 4c 89 fa mov %r15,%rdx 1b: 4c 8b 7c 24 10 mov 0x10(%rsp),%r15 20: 4c 03 3a add (%rdx),%r15 23: 4c 89 f8 mov %r15,%rax 26: 48 c1 e8 03 shr $0x3,%rax * 2a: 80 3c 30 00 cmpb $0x0,(%rax,%rsi,1) <-- trapping instruction 2e: 74 08 je 0x38 30: 4c 89 ff mov %r15,%rdi 33: e8 1a 3a 45 00 call 0x453a52 38: 48 8b 44 24 20 mov 0x20(%rsp),%rax 3d: 49 89 07 mov %rax,(%r15)