]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
mm: madvise: skip unmapped vma holes passed to process_madvise
authorCharan Teja Kalla <quic_charante@quicinc.com>
Tue, 22 Mar 2022 21:46:48 +0000 (14:46 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:37:35 +0000 (14:37 +0200)
commit9cc906fd1a31a8b592e07ebafc2b537f0078346d
treefa9f9658951d6981af1aa200590bfb1426fb16e9
parentf2d2ad27b9aba9643c592cec45ff9297a4cc89c2
mm: madvise: skip unmapped vma holes passed to process_madvise

BugLink: https://bugs.launchpad.net/bugs/1969110
commit 08095d6310a7ce43256b4251577bc66a25c6e1a6 upstream.

The process_madvise() system call is expected to skip holes in vma passed
through 'struct iovec' vector list.  But do_madvise, which
process_madvise() calls for each vma, returns ENOMEM in case of unmapped
holes, despite the VMA is processed.

Thus process_madvise() should treat ENOMEM as expected and consider the
VMA passed to as processed and continue processing other vma's in the
vector list.  Returning -ENOMEM to user, despite the VMA is processed,
will be unable to figure out where to start the next madvise.

Link: https://lkml.kernel.org/r/4f091776142f2ebf7b94018146de72318474e686.1647008754.git.quic_charante@quicinc.com
Fixes: ecb8ac8b1f14("mm/madvise: introduce process_madvise() syscall: an external memory hinting API")
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 27d96f11b0a2f28589485da1bbce3240ab1cedbe)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
mm/madvise.c