linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@Oracle.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	John Hsu <John.Hsu@mediatek.com>,
	stable@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH stable v6.1] mm/mmap: Fix extra maple tree write
Date: Fri, 14 Jul 2023 11:00:39 -0400	[thread overview]
Message-ID: <20230714150039.xr4wdigb6us27ln4@revolver> (raw)
In-Reply-To: <f8177a33-f341-d285-ff9a-24fdd3936f9a@suse.cz>

* Vlastimil Babka <vbabka@suse.cz> [230714 10:44]:
> On 7/12/23 02:54, Liam R. Howlett wrote:
> > * Liam R. Howlett <Liam.Howlett@Oracle.com> [230707 12:45]:
> >> * Greg KH <gregkh@linuxfoundation.org> [230707 11:55]:
> >> > On Thu, Jul 06, 2023 at 02:51:35PM -0400, Liam R. Howlett wrote:
> >> > > commit 0503ea8f5ba73eb3ab13a81c1eefbaf51405385a upstream.
> >> > > 
> >> > > This was inadvertently fixed during the removal of __vma_adjust().
> >> > > 
> >> > > When __vma_adjust() is adjusting next with a negative value (pushing
> >> > > vma->vm_end lower), there would be two writes to the maple tree.  The
> >> > > first write is unnecessary and uses all allocated nodes in the maple
> >> > > state.  The second write is necessary but will need to allocate nodes
> >> > > since the first write has used the allocated nodes.  This may be a
> >> > > problem as it may not be safe to allocate at this time, such as a low
> >> > > memory situation.  Fix the issue by avoiding the first write and only
> >> > > write the adjusted "next" VMA.
> >> > 
> >> > Are you sure this is the same git id?  The one you reference above is
> >> > _VERY_ different from your 2 line change below.
> >> > 
> >> > And the changelog text is not the same.
> >> 
> >> Yes, but I am not sure I've indicated what happened correctly.
> 
> "commit 0503ea8f5ba73eb3ab13a81c1eefbaf51405385a upstream." is indeed not
> the best indication. For stable it would mean you're backporting said
> commit, which is not the case.

Okay, thanks.  I am certainly not doing that.

> 
> >> The bug exists in the older __vma_adjust() function, but I removed
> >> __vma_adjust() and inadvertently fixed the bug.  So the bug doesn't
> >> exist upstream *because* of that commit:
> >> 
> >> 0503ea8f5ba7 ("mm/mmap: remove __vma_adjust()")
> >> 
> >> My comment after the commit id indicates what happened, but the
> >> documentation wasn't clear to me on how to specify what happened.
> 
> I think it's because the process discourages stable-specific fixes. However
> this is the case where such approach is much simpler than  backporting
> several series with non-trivial vma_merge() cleanups and subsequent
> follow-up fixes...

Thanks, and I agree.  I want to avoid that at all costs.  The chances of
introducing subtle bugs would be unacceptable for stable.

> 
> So I agree with the exceptional stable-specific fix. Can you pinpoint a
> Fixes: tag? Some of the commits introducing the maple tree?

Fixes: 3b0e81a1cdc9 ("mmap: change zeroing of maple tree in __vma_adjust()")

Thanks for the response & explanation,
Liam


  reply	other threads:[~2023-07-14 15:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-06 18:51 Liam R. Howlett
2023-07-07 15:55 ` Greg KH
2023-07-07 16:45   ` Liam R. Howlett
2023-07-12  0:54     ` Liam R. Howlett
2023-07-14 14:44       ` Vlastimil Babka
2023-07-14 15:00         ` Liam R. Howlett [this message]
2023-07-16 15:05       ` Greg KH
2023-07-16 15:05 ` Patch "mm/mmap: Fix extra maple tree write" has been added to the 6.1-stable tree gregkh
2023-07-16 15:08 ` Patch "mm/mmap: Fix extra maple tree write" has been added to the 5.4-stable tree gregkh

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=20230714150039.xr4wdigb6us27ln4@revolver \
    --to=liam.howlett@oracle.com \
    --cc=John.Hsu@mediatek.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /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