================================================================== BUG: KASAN: slab-out-of-bounds in unlink_file_vma+0x66/0x190 mm/mmap.c:162 Read of size 8 at addr ffff8881ef0a6b58 by task syz.0.1710/6753 CPU: 1 PID: 6753 Comm: syz.0.1710 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 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132 unlink_file_vma+0x66/0x190 mm/mmap.c:162 free_pgtables+0x1f4/0x280 mm/memory.c:414 exit_mmap+0x2ca/0x520 mm/mmap.c:3192 __mmput+0x92/0x2e0 kernel/fork.c:1101 mmput+0x47/0x60 kernel/fork.c:1122 exit_mm kernel/exit.c:538 [inline] do_exit+0x99f/0x2660 kernel/exit.c:848 do_group_exit+0x13e/0x300 kernel/exit.c:984 get_signal+0xdee/0x13d0 kernel/signal.c:2738 do_signal+0xad/0xda0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xc4/0x1b0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x18e/0x1f0 arch/x86/entry/common.c:194 syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x13e/0x170 arch/x86/entry/common.c:300 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f383dba7969 Code: Bad RIP value. RSP: 002b:00007f383c210038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffea RBX: 00007f383ddcefa0 RCX: 00007f383dba7969 RDX: 0000000000000048 RSI: 000020000000e000 RDI: 0000000000000005 RBP: 00007f383dc29ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f383ddcefa0 R15: 00007ffc0c324f48 Allocated by task 6770: 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 103: 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] cleanup_net+0xab8/0xb40 net/core/net_namespace.c:633 process_one_work+0x73b/0xcc0 kernel/workqueue.c:2290 worker_thread+0xa5c/0x13b0 kernel/workqueue.c:2436 kthread+0x31e/0x3a0 kernel/kthread.c:288 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:354 The buggy address belongs to the object at ffff8881ef0a5a00 which belongs to the cache net_namespace of size 4352 The buggy address is located 88 bytes to the right of 4352-byte region [ffff8881ef0a5a00, ffff8881ef0a6b00) The buggy address belongs to the page: page:ffffea0007bc2800 refcount:1 mapcount:0 mapping:ffff8881f5d02280 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 0000000000000000 0000000100000001 ffff8881f5d02280 raw: 0000000000000000 0000000080070007 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 getname+0x19/0x20 fs/namei.c:212 do_sys_open+0x26c/0x5d0 fs/open.c:1117 Memory state around the buggy address: ffff8881ef0a6a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff8881ef0a6a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff8881ef0a6b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff8881ef0a6b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881ef0a6c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== BUG: kernel NULL pointer dereference, address: 0000000000000030 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 1e465f067 P4D 1e465f067 PUD 0 Oops: 0002 [#1] PREEMPT SMP KASAN CPU: 0 PID: 6753 Comm: syz.0.1710 Tainted: G B 5.4.292-syzkaller-00021-gcd8e74fa0fa3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 RIP: 0010:arch_atomic64_try_cmpxchg arch/x86/include/asm/atomic64_64.h:186 [inline] RIP: 0010:atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1505 [inline] RIP: 0010:atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline] RIP: 0010:__down_write kernel/locking/rwsem.c:1424 [inline] RIP: 0010:down_write+0x8c/0x110 kernel/locking/rwsem.c:1583 Code: 48 c7 44 24 20 00 00 00 00 be 08 00 00 00 e8 8b 96 62 fd 4c 89 f7 be 08 00 00 00 e8 7e 96 62 fd 48 8b 44 24 20 b9 01 00 00 00 48 0f b1 0b 75 5f 48 83 c3 08 65 4c 8b 35 b1 d0 d7 7b 48 89 df RSP: 0018:ffff8881eda2f740 EFLAGS: 00010256 RAX: 0000000000000000 RBX: 0000000000000030 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff8881eda2f760 RBP: ffff8881eda2f7c8 R08: dffffc0000000000 R09: ffffed103db45eed R10: ffffed103db45eed R11: 1ffff1103db45eec R12: 1ffff1103db45ee8 R13: ffff8881df3df128 R14: ffff8881eda2f760 R15: dffffc0000000000 FS: 00007f383c2106c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000030 CR3: 00000001da62e000 CR4: 00000000003406b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Call Trace: i_mmap_lock_write include/linux/fs.h:551 [inline] unlink_file_vma+0x76/0x190 mm/mmap.c:163 free_pgtables+0x1f4/0x280 mm/memory.c:414 exit_mmap+0x2ca/0x520 mm/mmap.c:3192 __mmput+0x92/0x2e0 kernel/fork.c:1101 mmput+0x47/0x60 kernel/fork.c:1122 exit_mm kernel/exit.c:538 [inline] do_exit+0x99f/0x2660 kernel/exit.c:848 do_group_exit+0x13e/0x300 kernel/exit.c:984 get_signal+0xdee/0x13d0 kernel/signal.c:2738 do_signal+0xad/0xda0 arch/x86/kernel/signal.c:809 exit_to_usermode_loop+0xc4/0x1b0 arch/x86/entry/common.c:159 prepare_exit_to_usermode+0x18e/0x1f0 arch/x86/entry/common.c:194 syscall_return_slowpath arch/x86/entry/common.c:274 [inline] do_syscall_64+0x13e/0x170 arch/x86/entry/common.c:300 entry_SYSCALL_64_after_hwframe+0x5c/0xc1 RIP: 0033:0x7f383dba7969 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:00007f383c210038 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 RAX: ffffffffffffffea RBX: 00007f383ddcefa0 RCX: 00007f383dba7969 RDX: 0000000000000048 RSI: 000020000000e000 RDI: 0000000000000005 RBP: 00007f383dc29ab1 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f383ddcefa0 R15: 00007ffc0c324f48 Modules linked in: CR2: 0000000000000030 ---[ end trace 65117b2d5e3a9174 ]--- RIP: 0010:arch_atomic64_try_cmpxchg arch/x86/include/asm/atomic64_64.h:186 [inline] RIP: 0010:atomic64_try_cmpxchg include/asm-generic/atomic-instrumented.h:1505 [inline] RIP: 0010:atomic_long_try_cmpxchg_acquire include/asm-generic/atomic-long.h:442 [inline] RIP: 0010:__down_write kernel/locking/rwsem.c:1424 [inline] RIP: 0010:down_write+0x8c/0x110 kernel/locking/rwsem.c:1583 Code: 48 c7 44 24 20 00 00 00 00 be 08 00 00 00 e8 8b 96 62 fd 4c 89 f7 be 08 00 00 00 e8 7e 96 62 fd 48 8b 44 24 20 b9 01 00 00 00 48 0f b1 0b 75 5f 48 83 c3 08 65 4c 8b 35 b1 d0 d7 7b 48 89 df RSP: 0018:ffff8881eda2f740 EFLAGS: 00010256 RAX: 0000000000000000 RBX: 0000000000000030 RCX: 0000000000000001 RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff8881eda2f760 RBP: ffff8881eda2f7c8 R08: dffffc0000000000 R09: ffffed103db45eed R10: ffffed103db45eed R11: 1ffff1103db45eec R12: 1ffff1103db45ee8 R13: ffff8881df3df128 R14: ffff8881eda2f760 R15: dffffc0000000000 FS: 00007f383c2106c0(0000) GS:ffff8881f6e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000030 CR3: 00000001da62e000 CR4: 00000000003406b0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 ---------------- Code disassembly (best guess): 0: 48 c7 44 24 20 00 00 movq $0x0,0x20(%rsp) 7: 00 00 9: be 08 00 00 00 mov $0x8,%esi e: e8 8b 96 62 fd call 0xfd62969e 13: 4c 89 f7 mov %r14,%rdi 16: be 08 00 00 00 mov $0x8,%esi 1b: e8 7e 96 62 fd call 0xfd62969e 20: 48 8b 44 24 20 mov 0x20(%rsp),%rax 25: b9 01 00 00 00 mov $0x1,%ecx * 2a: f0 48 0f b1 0b lock cmpxchg %rcx,(%rbx) <-- trapping instruction 2f: 75 5f jne 0x90 31: 48 83 c3 08 add $0x8,%rbx 35: 65 4c 8b 35 b1 d0 d7 mov %gs:0x7bd7d0b1(%rip),%r14 # 0x7bd7d0ee 3c: 7b 3d: 48 89 df mov %rbx,%rdi