]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again
authorYuanyuan Zhong <yzhong@purestorage.com>
Thu, 23 May 2024 18:35:31 +0000 (12:35 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:47:42 +0000 (13:47 +0200)
commit2eeff6e36cd36086ed32fe6bcf86d0482f527bf1
tree7855d5eb5e0bf3dca4ac3ac1ebd8744e5ca15d3f
parentcb3ea7684a437283dbe4ec889f432fa45f7731be
mm: /proc/pid/smaps_rollup: avoid skipping vma after getting mmap_lock again

commit 6d065f507d82307d6161ac75c025111fb8b08a46 upstream.

After switching smaps_rollup to use VMA iterator, searching for next entry
is part of the condition expression of the do-while loop.  So the current
VMA needs to be addressed before the continue statement.

Otherwise, with some VMAs skipped, userspace observed memory
consumption from /proc/pid/smaps_rollup will be smaller than the sum of
the corresponding fields from /proc/pid/smaps.

Link: https://lkml.kernel.org/r/20240523183531.2535436-1-yzhong@purestorage.com
Fixes: c4c84f06285e ("fs/proc/task_mmu: stop using linked list and highest_vm_end")
Signed-off-by: Yuanyuan Zhong <yzhong@purestorage.com>
Reviewed-by: Mohamed Khalfella <mkhalfella@purestorage.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/proc/task_mmu.c