From: Pratyush Yadav <pratyush@kernel.org>
To: Mike Rapoport <rppt@kernel.org>
Cc: Pratyush Yadav <pratyush@kernel.org>,
Alexander Graf <graf@amazon.com>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Hugh Dickins <hughd@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jason Gunthorpe <jgg@nvidia.com>,
Samiullah Khawaja <skhawaja@google.com>,
kexec@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm: memfd_luo: preserve file seals
Date: Tue, 10 Feb 2026 14:15:48 +0100 [thread overview]
Message-ID: <2vxzo6lwu4cb.fsf@kernel.org> (raw)
In-Reply-To: <aXd8I4czYUpl72qq@kernel.org> (Mike Rapoport's message of "Mon, 26 Jan 2026 16:37:23 +0200")
On Mon, Jan 26 2026, Mike Rapoport wrote:
> Hi Pratyush,
>
> On Mon, Jan 26, 2026 at 01:47:21PM +0100, Pratyush Yadav wrote:
>> Hi Mike,
>>
>> On Sun, Jan 25 2026, Mike Rapoport wrote:
>> > On Fri, Jan 23, 2026 at 10:58:51AM +0100, Pratyush Yadav wrote:
>
> ...
>
>> >> - file = memfd_alloc_file("", 0);
>> >> + /*
>> >> + * The seals are preserved. Allow sealing here so they can be added
>> >> + * later.
>> >> + */
>> >> + file = memfd_alloc_file("", MFD_ALLOW_SEALING);
>> >
>> > I think we should select flags passed to memfd_alloc_file() based on
>> > ser->seals (and later based on ser->seals and ser->flags).
>>
>> Not sure what you mean.
>>
>> I think the only seal we can set via memfd_alloc_file() flags is
>> MFD_NOEXEC_SEAL, which is really a F_SEAL_EXEC and plus a change of the
>> inode's mode. And now that I think of it, that is a valid use case that
>> we might as well support. But I think that should be done by preserving
>> the mode of the inode directly, and then copying the seals back. The
>> main reason for that is that the mode can be changed after the memfd is
>> created too.
>>
>> Other than that, all other seals are set by fcntl (via
>> memfd_add_seals()), so I don't see what else we can pass to
>> memfd_alloc_file().
>
> Hmm, "using ser->seals" was bad phrasing :)
>
> Now we add support for creating memfd with MFD_ALLOW_SEALING and at some
> point we'd want MFD_HUGETLB and huge page size.
> So I think we should have a field in ser that will define what flags should
> be used for creation of memfd and based on the value of that field pass the
> flags to memfd_alloc_file().
I am not planning to re-use any of memfd machinery we have now for
HugeTLB. The main reason is that the HugeTLB support is different enough
that any shared code or data structures aren't worth the extra
complexity.
So HugeTLB gets its own serialization structures and file handlers.
struct hugemfd_ser in [0] has a field for order which we can use to
decide the flags.
[0] https://lore.kernel.org/linux-mm/20251206230222.853493-11-pratyush@kernel.org/
>
> For seals support this field can be hardwired to MFD_ALLOW_SEALING at preserve
> time.
[...]
--
Regards,
Pratyush Yadav
next prev parent reply other threads:[~2026-02-10 13:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-23 9:58 [PATCH 0/2] " Pratyush Yadav
2026-01-23 9:58 ` [PATCH 1/2] memfd: export memfd_{add,get}_seals() Pratyush Yadav
2026-01-25 11:52 ` Mike Rapoport
2026-01-23 9:58 ` [PATCH 2/2] mm: memfd_luo: preserve file seals Pratyush Yadav
2026-01-25 12:03 ` Mike Rapoport
2026-01-26 12:47 ` Pratyush Yadav
2026-01-26 14:37 ` Mike Rapoport
2026-02-10 13:15 ` Pratyush Yadav [this message]
2026-01-26 18:31 ` Jason Gunthorpe
2026-02-10 13:10 ` Pratyush Yadav
2026-02-10 13:13 ` Jason Gunthorpe
2026-02-10 13:53 ` Pratyush Yadav
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=2vxzo6lwu4cb.fsf@kernel.org \
--to=pratyush@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=graf@amazon.com \
--cc=hughd@google.com \
--cc=jgg@nvidia.com \
--cc=kexec@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.com \
--cc=rppt@kernel.org \
--cc=skhawaja@google.com \
/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