From: Suren Baghdasaryan <surenb@google.com>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>,
Vlastimil Babka <vbabka@suse.cz>,
sidhartha.kumar@oracle.com, Matthew Wilcox <willy@infradead.org>,
Lorenzo Stoakes <lstoakes@gmail.com>,
linux-fsdevel@vger.kernel.org, bpf@vger.kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 1/5] mm/mmap: Correctly position vma_iterator in __split_vma()
Date: Wed, 5 Jun 2024 17:51:05 -0700 [thread overview]
Message-ID: <CAJuCfpHqDNGM=6+TX4xE-YY91fETSM+r70ZdgxUyw=9X+3qQCQ@mail.gmail.com> (raw)
In-Reply-To: <20240531163217.1584450-2-Liam.Howlett@oracle.com>
On Fri, May 31, 2024 at 9:33 AM Liam R. Howlett <Liam.Howlett@oracle.com> wrote:
>
> The vma iterator may be left pointing to the newly created vma. This
> happens when inserting the new vma at the end of the old vma
> (!new_below).
>
> The incorrect position in the vma iterator is not exposed currently
> since the vma iterator is repositioned in the munmap path and is not
> reused in any of the other paths.
>
> This has limited impact in the current code, but is required for future
> changes.
>
> Fixes: b2b3b886738f ("mm: don't use __vma_adjust() in __split_vma()")
> Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
> ---
> mm/mmap.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 83b4682ec85c..31d464e6a656 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -2442,6 +2442,9 @@ static int __split_vma(struct vma_iterator *vmi, struct vm_area_struct *vma,
> /* Success. */
> if (new_below)
> vma_next(vmi);
> + else
> + vma_prev(vmi);
> +
IIUC the goal is to always point vmi to the old (original) vma? If so,
then change LGTM.
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
> return 0;
>
> out_free_mpol:
> --
> 2.43.0
>
next prev parent reply other threads:[~2024-06-06 0:51 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-31 16:32 [RFC PATCH 0/5] Avoid MAP_FIXED gap exposure Liam R. Howlett
2024-05-31 16:32 ` [RFC PATCH 1/5] mm/mmap: Correctly position vma_iterator in __split_vma() Liam R. Howlett
2024-06-06 0:51 ` Suren Baghdasaryan [this message]
2024-06-07 14:25 ` Liam R. Howlett
2024-06-10 12:09 ` Lorenzo Stoakes
2024-05-31 16:32 ` [RFC PATCH 2/5] mm/mmap: Split do_vmi_align_munmap() into a gather and complete operation Liam R. Howlett
2024-06-07 0:14 ` Suren Baghdasaryan
2024-06-07 14:23 ` Liam R. Howlett
2024-05-31 16:32 ` [RFC PATCH 3/5] mm/mmap: Introduce vma_munmap_struct for use in munmap operations Liam R. Howlett
2024-06-07 14:38 ` Suren Baghdasaryan
2024-05-31 16:32 ` [RFC PATCH 4/5] mm/mmap: Change munmap to use vma_munmap_struct() for accounting and surrounding vmas Liam R. Howlett
2024-06-07 14:38 ` Suren Baghdasaryan
2024-06-07 15:24 ` Liam R. Howlett
2024-05-31 16:32 ` [RFC PATCH 5/5] mm/mmap: Use split munmap calls for MAP_FIXED Liam R. Howlett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJuCfpHqDNGM=6+TX4xE-YY91fETSM+r70ZdgxUyw=9X+3qQCQ@mail.gmail.com' \
--to=surenb@google.com \
--cc=Liam.Howlett@oracle.com \
--cc=andrii.nakryiko@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lstoakes@gmail.com \
--cc=sidhartha.kumar@oracle.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox