Re: [PATCH] mm/filemap: Fix logic around SIGBUS in filemap_map_pages()

From: Matthew Wilcox

Date: Thu Nov 20 2025 - 12:00:16 EST


On Thu, Nov 20, 2025 at 04:14:11PM +0000, Kiryl Shutsemau wrote:
> Chris noticed that filemap_map_pages() calculates can_map_large only
> once for the first page in the fault around range. The value is not
> valid for the following pages in the range and must be recalculated.
>
> Instead of recalculating can_map_large on each iteration, pass down
> file_end to filemap_map_folio_range() and let it make the decision on
> what can be mapped.
>
> Signed-off-by: Kiryl Shutsemau <kas@xxxxxxxxxx>
> Reported-by: Chris Mason <clm@xxxxxxxx>
> Fixes: 74207de2ba10 ("mm/memory: do not populate page table entries beyond i_size")h

Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>