BUG: Bad rss-counter state mm:000000004ceb13e2 type:MM_FILEPAGES val:33 BUG: Bad rss-counter state mm:000000004ceb13e2 type:MM_ANONPAGES val:22 ================================================================== BUG: KASAN: slab-use-after-free in vma_interval_tree_remove+0xc75/0xec0 Read of size 8 at addr ffff888010019b38 by task sshd/219 CPU: 0 PID: 219 Comm: sshd Not tainted 6.4.0-rc7-next-20230620 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Call Trace: dump_stack_lvl+0x91/0xf0 print_report+0xcc/0x620 kasan_report+0xbe/0xf0 vma_interval_tree_remove+0xc75/0xec0 vma_prepare+0xc54/0x11a0 __split_vma+0x5af/0x950 do_vmi_align_munmap+0x2ba/0x11f0 do_vmi_munmap+0x1f1/0x2b0 mmap_region+0x1f9/0x2660 do_mmap+0x854/0xf00 vm_mmap_pgoff+0x1a6/0x3a0 ksys_mmap_pgoff+0x3af/0x500 Code: eb aa 66 0f 1f 44 00 00 41 f7 c1 ff 0f 00 00 75 27 55 48 89 fd 53 89 cb 48 85 ff 74 33 41 89 da 48 89 ef b8 09 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 56 5b 5d c3 0f 1f 00 c7 05 ae 03 01 00 16 00 RSP: 002b:00007ffdecb7c7d8 EFLAGS: 00000206 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 0000000000000812 RCX: 00007fb25e799d82 RDX: 0000000000000005 RSI: 0000000000001000 RDI: 00007fb25dbd3000 RBP: 00007fb25dbd3000 R08: 0000000000000009 R09: 0000000000001000 R10: 0000000000000812 R11: 0000000000000206 R12: 000055ca10551ec0 R13: 00007ffdecb7c7f0 R14: 00007ffdecb7c820 R15: 00007ffdecb7cb80 Allocated by task 212: kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 __kasan_slab_alloc+0x59/0x70 kmem_cache_alloc+0x16b/0x370 vm_area_dup+0x20/0x160 __split_vma+0x170/0x950 split_vma+0xc6/0x110 mprotect_fixup+0x8d2/0xb30 do_mprotect_pkey+0x87e/0xd40 __x64_sys_mprotect+0x78/0xc0 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 Freed by task 212: kasan_save_stack+0x22/0x50 kasan_set_track+0x25/0x30 kasan_save_free_info+0x2b/0x50 __kasan_slab_free+0x10a/0x190 kmem_cache_free+0x10d/0x4d0 rcu_core+0x8c8/0x2860 __do_softirq+0x1b7/0x7d4 Last potentially related work creation: kasan_save_stack+0x22/0x50 __kasan_record_aux_stack+0x8e/0xa0 __call_rcu_common.constprop.0+0x6a/0xb90 remove_vma+0x139/0x170 do_vmi_align_munmap+0xd4a/0x11f0 do_vmi_munmap+0x1f1/0x2b0 __vm_munmap+0x138/0x3a0 __x64_sys_munmap+0x59/0x80 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 The buggy address belongs to the object at ffff888010019ae0 which belongs to the cache vm_area_struct of size 168 The buggy address is located 88 bytes inside of freed 168-byte region [ffff888010019ae0, ffff888010019b88) The buggy address belongs to the physical page: page:00000000dfe88ecf refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10019 memcg:ffff888016f75701 flags: 0x100000000000200(slab|node=0|zone=1) page_type: 0xffffffff() raw: 0100000000000200 ffff8880087a0c80 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000110011 00000001ffffffff ffff888016f75701 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff888010019a00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888010019a80: 00 00 00 00 fc fc fc fc fc fc fc fc fa fb fb fb >ffff888010019b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888010019b80: fb fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb ffff888010019c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc ================================================================== BUG: Bad rss-counter state mm:000000004e06ee61 type:MM_FILEPAGES val:33 BUG: Bad rss-counter state mm:000000004e06ee61 type:MM_ANONPAGES val:22 BUG: Bad rss-counter state mm:0000000007c1c135 type:MM_FILEPAGES val:33 BUG: Bad rss-counter state mm:0000000007c1c135 type:MM_ANONPAGES val:22 kmemleak: Automatic memory scanning thread ended cgroup: Unknown subsys name 'net' cgroup: Unknown subsys name 'rlimit' ---------------- Code disassembly (best guess): 0: eb aa jmp 0xffffffac 2: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) 8: 41 f7 c1 ff 0f 00 00 test $0xfff,%r9d f: 75 27 jne 0x38 11: 55 push %rbp 12: 48 89 fd mov %rdi,%rbp 15: 53 push %rbx 16: 89 cb mov %ecx,%ebx 18: 48 85 ff test %rdi,%rdi 1b: 74 33 je 0x50 1d: 41 89 da mov %ebx,%r10d 20: 48 89 ef mov %rbp,%rdi 23: b8 09 00 00 00 mov $0x9,%eax 28: 0f 05 syscall * 2a: 48 3d 00 f0 ff ff cmp $0xfffffffffffff000,%rax <-- trapping instruction 30: 77 56 ja 0x88 32: 5b pop %rbx 33: 5d pop %rbp 34: c3 retq 35: 0f 1f 00 nopl (%rax) 38: c7 .byte 0xc7 39: 05 ae 03 01 00 add $0x103ae,%eax 3e: 16 (bad)