From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Hugh Dickins <hughd@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
David Rheinsberg <david@readahead.eu>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>, Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org, stable@vger.kernel.org,
Chris Mason <mason@kernel.org>
Subject: Re: [PATCH 0/2] mm/memfd: handle GUP references reliably when write-sealing
Date: Thu, 5 Nov 2026 11:14:19 +0100 [thread overview]
Message-ID: <fc197480-ef57-4279-a48d-101f5f41f8d3@kernel.org> (raw)
In-Reply-To: <20261103-fixes_core_2-v1-0-f332954f1df4@kernel.org>
On 11/3/26 19:31, David Hildenbrand (Arm) wrote:
> I spent way too much time on this, looking for better options. I think
> patch #1 fixes the most immediate issues but something like patch #2 is
> needed.
>
> Long story short: someone can trigger a race such that we don't detect
> GUP references when write-sealing, allowing to modify content later.
>
> Patch #1 handles pins reliably for folios with a pincount. Patch #2
> handles the remaining references, but can reject write-sealing with
> populated file mappings. vm.memfd_write_seal_mapped allows restoring the
> legacy behavior if needed.
>
> All alternatives to patch #2 I tried ended up too complicated and nasty
> in corner cases. We should never have allowed write-sealing with
> existing file mappings.
>
> Plenty of details in patch #2.
>
> Did some testing on x86-64 without any surprises.
>
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> ---
> David Hildenbrand (Arm) (2):
> mm/memfd: handle GUP pins more reliably when write-sealing
> mm/memfd: handle GUP references reliably when write-sealing
>
> Documentation/admin-guide/sysctl/vm.rst | 21 +++++++++++++++
> mm/memfd.c | 45 ++++++++++++++++++++++++++++++++-
> 2 files changed, 65 insertions(+), 1 deletion(-)
I think patch #1 is uncontroversial. It would be good to get some options on #2.
With the current infrastructure we have, I don't really see a good way to tackle
this differently.
I'd assume CRIU+write-sealed-memfd+mlock is rather the corner case ... :)
--
Cheers,
David
prev parent reply other threads:[~2026-11-05 10:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 18:31 David Hildenbrand (Arm)
2026-11-03 18:31 ` [PATCH 1/2] mm/memfd: handle GUP pins more " David Hildenbrand (Arm)
2026-11-04 9:15 ` Lorenzo Stoakes (ARM)
2026-11-03 18:31 ` [PATCH 2/2] mm/memfd: handle GUP references " David Hildenbrand (Arm)
2026-11-05 10:14 ` David Hildenbrand (Arm) [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=fc197480-ef57-4279-a48d-101f5f41f8d3@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=corbet@lwn.net \
--cc=david@readahead.eu \
--cc=hughd@google.com \
--cc=liam@infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mason@kernel.org \
--cc=mhocko@suse.com \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.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
all inboxes | Powered by JetHome®