From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Suren Baghdasaryan <surenb@google.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Pedro Falcato <pfalcato@suse.de>,
David Hildenbrand <david@redhat.com>,
Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
Jann Horn <jannh@google.com>,
shikemeng@huaweicloud.com, kasong@tencent.com, nphamcs@gmail.com,
bhe@redhat.com, baohua@kernel.org, chrisl@kernel.org,
Matthew Wilcox <willy@infradead.org>
Subject: Re: [PATCH v3 00/11] Remove XA_ZERO from error recovery of dup_mmap()
Date: Wed, 21 Jan 2026 14:34:45 -0500 [thread overview]
Message-ID: <ddyvvndzveegw47wpvlqdushau2qqbue5fwfsylanntoi3apyz@l7ah6cnmrpnp> (raw)
In-Reply-To: <20260121105915.5513fb9de156c3f415a1dcd3@linux-foundation.org>
* Andrew Morton <akpm@linux-foundation.org> [260121 13:59]:
> On Wed, 21 Jan 2026 11:49:35 -0500 "Liam R. Howlett" <Liam.Howlett@oracle.com> wrote:
>
> > It is possible that the dup_mmap() call fails on allocating or setting
> > up a vma after the maple tree of the oldmm is copied. Today, that
> > failure point is marked by inserting an XA_ZERO entry over the failure
> > point so that the exact location does not need to be communicated
> > through to exit_mmap().
> >
> > However, a race exists in the tear down process because the dup_mmap()
> > drops the mmap lock before exit_mmap() can remove the partially set up
> > vma tree. This means that other tasks may get to the mm tree and find
> > the invalid vma pointer (since it's an XA_ZERO entry), even though the
> > mm is marked as MMF_OOM_SKIP and MMF_UNSTABLE.
> >
> > To remove the race fully, the tree must be cleaned up before dropping
> > the lock. This is accomplished by extracting the vma cleanup in
> > exit_mmap() and changing the required functions to pass through the vma
> > search limit. Any other tree modifications would require extra cycles
> > which should be spent on freeing memory.
>
> I've updated mm-unstable to this version. thanks.
>
> > Changes since v2:
> > - Fixed header issue - Thanks Lorenzo & SeongJae
>
> According to my thing, this is how v3 altered mm.git:
>
>
> --- a/include/linux/pgtable.h~b
> +++ a/include/linux/pgtable.h
> @@ -1660,6 +1660,7 @@ void arch_sync_kernel_mappings(unsigned
> #define FIRST_USER_ADDRESS 0UL
> #endif
>
> +
> /*
> * No-op macros that just return the current protection value. Defined here
> * because these macros can be used even if CONFIG_MMU is not defined.
> _
>
>
> So I assume you incorporated SeongJae's fix as-is.
Pretty close.
I messed up the whitespace, which is probably the delta. I also added
the header change to this patch (from Lorenzo), but I probably should
have put that in the later patch (like SJ said in his response to my
patch). I don't think there's any harm either way.
Thanks,
Liam
prev parent reply other threads:[~2026-01-21 19:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-21 16:49 Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 01/11] mm: Relocate the page table ceiling and floor definitions Liam R. Howlett
2026-01-21 17:26 ` SeongJae Park
2026-01-21 18:52 ` Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 02/11] mm/mmap: Move exit_mmap() trace point Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 03/11] mm/mmap: Abstract vma clean up from exit_mmap() Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 04/11] mm/vma: Add limits to unmap_region() for vmas Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 05/11] mm/memory: Add tree limit to free_pgtables() Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 06/11] mm/vma: Add page table limit to unmap_region() Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 07/11] mm: Change dup_mmap() recovery Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 08/11] mm: Introduce unmap_desc struct to reduce function arguments Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 09/11] mm/vma: Use unmap_desc in exit_mmap() and vms_clear_ptes() Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 10/11] mm/vma: Use unmap_region() in vms_clear_ptes() Liam R. Howlett
2026-01-21 16:49 ` [PATCH v3 11/11] mm: Use unmap_desc struct for freeing page tables Liam R. Howlett
2026-01-24 18:45 ` Chris Mason
2026-02-07 12:37 ` Liam R. Howlett
2026-02-10 20:41 ` Liam R. Howlett
2026-02-10 21:42 ` [PATCH] mm: Fix up unmap desc use on exit_mmap() Liam R. Howlett
2026-01-21 18:59 ` [PATCH v3 00/11] Remove XA_ZERO from error recovery of dup_mmap() Andrew Morton
2026-01-21 19:34 ` Liam R. Howlett [this message]
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=ddyvvndzveegw47wpvlqdushau2qqbue5fwfsylanntoi3apyz@l7ah6cnmrpnp \
--to=liam.howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=bhe@redhat.com \
--cc=chrisl@kernel.org \
--cc=david@redhat.com \
--cc=jannh@google.com \
--cc=kasong@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=nphamcs@gmail.com \
--cc=pfalcato@suse.de \
--cc=shikemeng@huaweicloud.com \
--cc=surenb@google.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