BUG: Bad rss-counter state mm:0000000000f459fb type:MM_FILEPAGES val:33 BUG: Bad rss-counter state mm:0000000000f459fb type:MM_ANONPAGES val:22 ================================================================== BUG: KASAN: slab-use-after-free in vma_interval_tree_remove+0xc75/0xec0 Read of size 8 at addr ffff88800e0e1ed8 by task sshd/219 CPU: 1 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 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7fad9b23ad82 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:00007fff0a304f68 EFLAGS: 00000206 ORIG_RAX: 0000000000000009 RAX: ffffffffffffffda RBX: 0000000000000812 RCX: 00007fad9b23ad82 RDX: 0000000000000005 RSI: 0000000000001000 RDI: 00007fad9a674000 RBP: 00007fad9a674000 R08: 0000000000000009 R09: 0000000000001000 R10: 0000000000000812 R11: 0000000000000206 R12: 0000563d40d58980 R13: 00007fff0a304f80 R14: 00007fff0a304fb0 R15: 00007fff0a305310 Allocated by task 206: 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 13: 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 ffff88800e0e1e80 which belongs to the cache vm_area_struct of size 168 The buggy address is located 88 bytes inside of freed 168-byte region [ffff88800e0e1e80, ffff88800e0e1f28) The buggy address belongs to the physical page: page:0000000049118b40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0xe0e1 memcg:ffff88800e234801 anon flags: 0x100000000000200(slab|node=0|zone=1) page_type: 0xffffffff() raw: 0100000000000200 ffff8880087a0c80 ffffea0000383200 dead000000000007 raw: 0000000000000000 0000000000110011 00000001ffffffff ffff88800e234801 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff88800e0e1d80: fc fc fc 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88800e0e1e00: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc >ffff88800e0e1e80: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88800e0e1f00: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc ffff88800e0e1f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== BUG: Bad rss-counter state mm:000000007a13f25c type:MM_FILEPAGES val:33 BUG: Bad rss-counter state mm:000000007a13f25c type:MM_ANONPAGES val:22 BUG: Bad rss-counter state mm:000000007e9be5a9 type:MM_FILEPAGES val:33 BUG: Bad rss-counter state mm:000000007e9be5a9 type:MM_ANONPAGES val:22 kmemleak: Cannot insert 0xffff88801be242f8 into the object search tree (overlaps existing) CPU: 0 PID: 237 Comm: sshd Tainted: G B 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 __create_object+0x736/0xc90 kmem_cache_alloc+0x20b/0x370 vm_area_dup+0x20/0x160 dup_mmap+0x94e/0x1770 copy_process+0x3e68/0x7320 kernel_clone+0xeb/0x7d0 __do_sys_clone+0xba/0x100 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7f2e1e3c84bb Code: ed 0f 85 f8 00 00 00 64 4c 8b 0c 25 10 00 00 00 45 31 c0 4d 8d 91 d0 02 00 00 31 d2 31 f6 bf 11 00 20 01 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 91 00 00 00 41 89 c5 85 c0 0f 85 9e 00 00 RSP: 002b:00007fffddbf8a40 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 0000000000008844 RCX: 00007f2e1e3c84bb RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f2e1df09900 R10: 00007f2e1df09bd0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000564a3cd88ec0 R14: 0000564a3cd992e0 R15: 00007fffddbf8ac0 kmemleak: Kernel memory leak detector disabled kmemleak: Object 0xffff88801be242b8 (size 168): kmemleak: comm "sshd", pid 237, jiffies 4294693987 kmemleak: min_count = 1 kmemleak: count = 0 kmemleak: flags = 0x1 kmemleak: checksum = 0 kmemleak: backtrace: vm_area_dup+0x20/0x160 dup_mmap+0x94e/0x1770 copy_process+0x3e68/0x7320 kernel_clone+0xeb/0x7d0 __do_sys_clone+0xba/0x100 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 kmemleak: Automatic memory scanning thread ended general protection fault, probably for non-canonical address 0xe0efdc23a000001b: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: maybe wild-memory-access in range [0x077f011d000000d8-0x077f011d000000df] CPU: 1 PID: 237 Comm: sshd Tainted: G B 6.4.0-rc7-next-20230620 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 RIP: 0010:__rb_insert_augmented+0x9d/0x8b0 Code: c2 48 c1 ea 03 42 80 3c 2a 00 0f 85 55 05 00 00 4d 8b 74 24 08 49 39 ee 0f 84 77 01 00 00 4d 85 f6 74 1c 4c 89 f2 48 c1 ea 03 <42> 80 3c 2a 00 0f 85 61 05 00 00 41 f6 06 01 0f 84 7a 04 00 00 48 RSP: 0018:ffff88800c55f948 EFLAGS: 00010216 RAX: ffff88801b8385d0 RBX: ffff88800e237210 RCX: ffffffff844d49f9 RDX: 00efe023a000001b RSI: 0000000000000008 RDI: ffff88800cbbea88 RBP: ffff88800bef9280 R08: ffff88800cbbea88 R09: 0000000000000000 R10: 0000000000000002 R11: 00000000000b6a61 R12: ffff88800cbbea80 R13: dffffc0000000000 R14: 077f011d000000db R15: ffffffff816e6340 FS: 00007f2e1df09900(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f42a9323100 CR3: 000000000eace000 CR4: 0000000000350ee0 Call Trace: dup_mmap+0xc45/0x1770 copy_process+0x3e68/0x7320 kernel_clone+0xeb/0x7d0 __do_sys_clone+0xba/0x100 do_syscall_64+0x3f/0x90 entry_SYSCALL_64_after_hwframe+0x6e/0xd8 RIP: 0033:0x7f2e1e3c84bb Code: ed 0f 85 f8 00 00 00 64 4c 8b 0c 25 10 00 00 00 45 31 c0 4d 8d 91 d0 02 00 00 31 d2 31 f6 bf 11 00 20 01 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 91 00 00 00 41 89 c5 85 c0 0f 85 9e 00 00 RSP: 002b:00007fffddbf8a40 EFLAGS: 00000246 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 0000000000008844 RCX: 00007f2e1e3c84bb RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011 RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f2e1df09900 R10: 00007f2e1df09bd0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000564a3cd88ec0 R14: 0000564a3cd992e0 R15: 00007fffddbf8ac0 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__rb_insert_augmented+0x9d/0x8b0 Code: c2 48 c1 ea 03 42 80 3c 2a 00 0f 85 55 05 00 00 4d 8b 74 24 08 49 39 ee 0f 84 77 01 00 00 4d 85 f6 74 1c 4c 89 f2 48 c1 ea 03 <42> 80 3c 2a 00 0f 85 61 05 00 00 41 f6 06 01 0f 84 7a 04 00 00 48 RSP: 0018:ffff88800c55f948 EFLAGS: 00010216 RAX: ffff88801b8385d0 RBX: ffff88800e237210 RCX: ffffffff844d49f9 RDX: 00efe023a000001b RSI: 0000000000000008 RDI: ffff88800cbbea88 RBP: ffff88800bef9280 R08: ffff88800cbbea88 R09: 0000000000000000 R10: 0000000000000002 R11: 00000000000b6a61 R12: ffff88800cbbea80 R13: dffffc0000000000 R14: 077f011d000000db R15: ffffffff816e6340 FS: 00007f2e1df09900(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f42a9323100 CR3: 000000000eace000 CR4: 0000000000350ee0 general protection fault, probably for non-canonical address 0x1723e26c000008: 0000 [#2] PREEMPT SMP KASAN NOPTI CPU: 1 PID: 33 Comm: kworker/u4:3 Tainted: G B D 6.4.0-rc7-next-20230620 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Workqueue: writeback wb_workfn (flush-8:0) RIP: 0010:qlist_free_all+0xaf/0x1a0 Code: 80 4c 01 c2 0f 82 f8 00 00 00 48 c7 c0 00 00 00 80 48 2b 05 7b 5e ab 03 48 01 d0 48 c1 e8 0c 48 c1 e0 06 48 03 05 59 5e ab 03 <48> 8b 48 08 48 89 c2 f6 c1 01 0f 85 ba 00 00 00 0f 1f 44 00 00 48 RSP: 0018:ffff888009517328 EFLAGS: 00010207 RAX: 001723e26c000000 RBX: 05ce011b000000ed RCX: 000000008011000c RDX: 05ce011b800000ed RSI: ffff88801be243a0 RDI: ffff8880087a0c80 RBP: 0000000000000000 R08: 05ce011b000000ed R09: 0000000000000000 R10: ffffea00006f8900 R11: 000000008011000c R12: dffffc0000000000 R13: ffff888009517368 R14: 0000000000000000 R15: ffff88801be243a0 FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2fae1436f8 CR3: 000000000d654000 CR4: 0000000000350ee0 Call Trace: kasan_quarantine_reduce+0x199/0x230 __kasan_slab_alloc+0x49/0x70 kmem_cache_alloc+0x16b/0x370 ext4_init_io_end+0x27/0x180 ext4_do_writepages+0xc31/0x3150 ext4_writepages+0x2fc/0x760 do_writepages+0x1ad/0x650 __writeback_single_inode+0x105/0xc50 writeback_sb_inodes+0x546/0xe20 __writeback_inodes_wb+0xbe/0x270 wb_writeback+0x48b/0x980 wb_workfn+0x81d/0xed0 process_one_work+0xabf/0x1770 worker_thread+0x64f/0x12a0 kthread+0x33f/0x440 ret_from_fork+0x2c/0x50 Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__rb_insert_augmented+0x9d/0x8b0 Code: c2 48 c1 ea 03 42 80 3c 2a 00 0f 85 55 05 00 00 4d 8b 74 24 08 49 39 ee 0f 84 77 01 00 00 4d 85 f6 74 1c 4c 89 f2 48 c1 ea 03 <42> 80 3c 2a 00 0f 85 61 05 00 00 41 f6 06 01 0f 84 7a 04 00 00 48 RSP: 0018:ffff88800c55f948 EFLAGS: 00010216 RAX: ffff88801b8385d0 RBX: ffff88800e237210 RCX: ffffffff844d49f9 RDX: 00efe023a000001b RSI: 0000000000000008 RDI: ffff88800cbbea88 RBP: ffff88800bef9280 R08: ffff88800cbbea88 R09: 0000000000000000 R10: 0000000000000002 R11: 00000000000b6a61 R12: ffff88800cbbea80 R13: dffffc0000000000 R14: 077f011d000000db R15: ffffffff816e6340 FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2fae1436f8 CR3: 000000000d654000 CR4: 0000000000350ee0 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 33 at kernel/exit.c:818 do_exit+0x1be5/0x2780 Modules linked in: CPU: 1 PID: 33 Comm: kworker/u4:3 Tainted: G B D 6.4.0-rc7-next-20230620 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 Workqueue: writeback wb_workfn (flush-8:0) RIP: 0010:do_exit+0x1be5/0x2780 Code: 00 00 31 f6 e8 6c 68 ff ff e9 09 f6 ff ff e8 42 7a 33 00 4c 89 ee bf 05 06 00 00 e8 c5 e2 02 00 e9 fc e8 ff ff e8 2b 7a 33 00 <0f> 0b e9 e2 e5 ff ff e8 1f 7a 33 00 0f 0b e9 9a e4 ff ff e8 13 7a RSP: 0018:ffff888009517e40 EFLAGS: 00010293 RAX: 0000000000000000 RBX: ffff888008f421c0 RCX: 0000000000000000 RDX: ffff888009501b40 RSI: ffffffff81188e35 RDI: ffff888009502cc0 RBP: ffff888009501b40 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff85d3d357 R11: 0000000000000001 R12: ffff888009502368 R13: 000000000000000b R14: ffff888008f3ae40 R15: 0000000000000000 FS: 0000000000000000(0000) GS:ffff88806cf00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f2fae1436f8 CR3: 000000000d654000 CR4: 0000000000350ee0 Call Trace: make_task_dead+0x175/0x3b0 rewind_stack_and_make_dead+0x17/0x20 RIP: 0000:0x0 Code: Unable to access opcode bytes at 0xffffffffffffffd6. RSP: 0000:0000000000000000 EFLAGS: 00000000 ORIG_RAX: 0000000000000000 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 irq event stamp: 6324 hardirqs last enabled at (6323): [] _raw_spin_unlock_irq+0x23/0x40 hardirqs last disabled at (6324): [] __schedule+0x127d/0x2b00 softirqs last enabled at (5896): [] irq_exit_rcu+0x93/0xc0 softirqs last disabled at (5887): [] irq_exit_rcu+0x93/0xc0 ---[ end trace 0000000000000000 ]--- ---------------- Code disassembly (best guess), 1 bytes skipped: 0: 48 c1 ea 03 shr $0x3,%rdx 4: 42 80 3c 2a 00 cmpb $0x0,(%rdx,%r13,1) 9: 0f 85 55 05 00 00 jne 0x564 f: 4d 8b 74 24 08 mov 0x8(%r12),%r14 14: 49 39 ee cmp %rbp,%r14 17: 0f 84 77 01 00 00 je 0x194 1d: 4d 85 f6 test %r14,%r14 20: 74 1c je 0x3e 22: 4c 89 f2 mov %r14,%rdx 25: 48 c1 ea 03 shr $0x3,%rdx * 29: 42 80 3c 2a 00 cmpb $0x0,(%rdx,%r13,1) <-- trapping instruction 2e: 0f 85 61 05 00 00 jne 0x595 34: 41 f6 06 01 testb $0x1,(%r14) 38: 0f 84 7a 04 00 00 je 0x4b8 3e: 48 rex.W