Re: [PATCHv3 1/2] mm/memory: Do not populate page table entries beyond i_size

From: Andrew Morton

Date: Mon Oct 27 2025 - 18:33:24 EST


On Mon, 27 Oct 2025 11:56:35 +0000 Kiryl Shutsemau <kirill@xxxxxxxxxxxxx> wrote:

> From: Kiryl Shutsemau <kas@xxxxxxxxxx>
>
> Accesses within VMA, but beyond i_size rounded up to PAGE_SIZE are
> supposed to generate SIGBUS.
>
> Recent changes attempted to fault in full folio where possible. They did
> not respect i_size, which led to populating PTEs beyond i_size and
> breaking SIGBUS semantics.
>
> Darrick reported generic/749 breakage because of this.
>
> However, the problem existed before the recent changes. With huge=always
> tmpfs, any write to a file leads to PMD-size allocation. Following the
> fault-in of the folio will install PMD mapping regardless of i_size.
>
> Fix filemap_map_pages() and finish_fault() to not install:
> - PTEs beyond i_size;
> - PMD mappings across i_size;
>
> Make an exception for shmem/tmpfs that for long time intentionally
> mapped with PMDs across i_size.
>
> Signed-off-by: Kiryl Shutsemau <kas@xxxxxxxxxx>
> Fixes: 19773df031bc ("mm/fault: try to map the entire file folio in finish_fault()")
> Fixes: 357b92761d94 ("mm/filemap: map entire large folio faultaround")
> Fixes: 01c70267053d ("fs: add a filesystem flag for THPs")

Multiple Fixes: are confusing.

We have two 6.18-rcX targets and one from 2020. Are we asking people
to backport this all the way back to 2020? If so I'd suggest the
removal of the more recent Fixes: targets.

Also, is [2/2] to be backported? The changelog makes it sound that way,
but no Fixes: was identified?