From: Pratyush Yadav <pratyush@kernel.org>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: David CARLIER <devnexen@gmail.com>,
akpm@linux-foundation.org, pratyush@kernel.org,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/memfd_luo: reject memfds whose page count exceeds UINT_MAX
Date: Mon, 04 May 2026 10:05:03 +0200 [thread overview]
Message-ID: <2vxzo6iv38i8.fsf@kernel.org> (raw)
In-Reply-To: <afUApNZQumxPQ3wu@plex> (Pasha Tatashin's message of "Fri, 1 May 2026 19:38:34 +0000")
On Fri, May 01 2026, Pasha Tatashin wrote:
> On 05-01 20:26, David CARLIER wrote:
>> On 2026-05-01 18:59, Pasha Tatashin wrote:
>> > I think, the fix should be first done at memfd_pin_folios() to
>> change
>> > max_folios to 'long' or 'unsigned long', and then just updated
>> > memfd_luo.c to match.
>>
>> Even with memfd_pin_folios() widened, memfd_luo_preserve_folios()
>> still
>> kvmalloc_objs()s the folios array up front -- at UINT_MAX entries
>> that's
>> already ~32 GiB of pointer array, which won't realistically succeed.
>> So
>> the guard here still makes sense, just on allocation grounds rather than
>> interface truncation.
>>
>> Happy to widen memfd_pin_folios() as a separate patch, but I'd keep
>> the
>> -EFBIG check regardless. Or did you have a different shape in mind?
>
> Ah, Good point about kvmalloc_objs(), I am not against this, even though
> it is a very theoretical issue.
Yeah. I plan to get rid of the pinning anyway and do this via the page
cache directly (might be easier said than done though), so this should
be fine for now I think. I suspect we might run into a lot more problems
if we get a memfd like this anyway.
Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
>
> Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>
--
Regards,
Pratyush Yadav
prev parent reply other threads:[~2026-05-04 8:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 12:56 [PATCH 1/2] mm/memfd_luo: reject memfds whose page count exceeds UINT_MAX David Carlier
2026-04-23 12:56 ` [PATCH 2/2] mm/memfd_luo: document preservation of file seals David Carlier
2026-05-01 19:41 ` Pasha Tatashin
2026-05-04 8:07 ` Pratyush Yadav
2026-05-01 18:59 ` [PATCH 1/2] mm/memfd_luo: reject memfds whose page count exceeds UINT_MAX Pasha Tatashin
2026-05-01 19:26 ` David CARLIER
2026-05-01 19:38 ` Pasha Tatashin
2026-05-04 8:05 ` Pratyush Yadav [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=2vxzo6iv38i8.fsf@kernel.org \
--to=pratyush@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=devnexen@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pasha.tatashin@soleen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.