Re: [PATCH 1/2] mm/memfd_luo: reject memfds whose page count exceeds UINT_MAX

From: David CARLIER

Date: Fri May 01 2026 - 15:26:23 EST


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?

Cheers.