On Fri, Nov 21, 2025 at 10:46:11AM +0100, Greg KH wrote:
On Thu, Nov 20, 2025 at 04:52:21PM +0000, Kiryl Shutsemau wrote:
Accesses within VMA, but beyond i_size rounded up to PAGE_SIZE are supposed to generate SIGBUS.
This behavior might not be respected on truncation.
During truncation, the kernel splits a large folio in order to reclaim memory. As a side effect, it unmaps the folio and destroys PMD mappings of the folio. The folio will be refaulted as PTEs and SIGBUS semantics are preserved.
However, if the split fails, PMD mappings are preserved and the user will not receive SIGBUS on any accesses within the PMD.
Unmap the folio on split failure. It will lead to refault as PTEs and preserve SIGBUS semantics.
Make an exception for shmem/tmpfs that for long time intentionally mapped with PMDs across i_size.
Link: https://lkml.kernel.org/r/20251027115636.82382-3-kirill@shutemov.name Fixes: b9a8a4195c7d ("truncate,shmem: Handle truncates that split large folios") Signed-off-by: Kiryl Shutsemau kas@kernel.org Cc: Al Viro viro@zeniv.linux.org.uk Cc: Baolin Wang baolin.wang@linux.alibaba.com Cc: Christian Brauner brauner@kernel.org Cc: "Darrick J. Wong" djwong@kernel.org Cc: Dave Chinner david@fromorbit.com Cc: David Hildenbrand david@redhat.com Cc: Hugh Dickins hughd@google.com Cc: Johannes Weiner hannes@cmpxchg.org Cc: Liam Howlett liam.howlett@oracle.com Cc: Lorenzo Stoakes lorenzo.stoakes@oracle.com Cc: Matthew Wilcox (Oracle) willy@infradead.org Cc: Michal Hocko mhocko@suse.com Cc: Mike Rapoport rppt@kernel.org Cc: Rik van Riel riel@surriel.com Cc: Shakeel Butt shakeel.butt@linux.dev Cc: Suren Baghdasaryan surenb@google.com Cc: Vlastimil Babka vbabka@suse.cz Cc: stable@vger.kernel.org Signed-off-by: Andrew Morton akpm@linux-foundation.org (cherry picked from commit fa04f5b60fda62c98a53a60de3a1e763f11feb41) Signed-off-by: Kiryl Shutsemau kas@kernel.org
Does not apply to 6.17.y at all :(
Did you forget to apply this on top of other commits?
Hm. It applies cleanly on v6.17.8:
❯ git log -1 --oneline @ 8ac42a63c561 (HEAD) Linux 6.17.8 ❯ b4 shazam 20251120165221.892852-1-kas@kernel.org Grabbing thread from lore.kernel.org/all/20251120165221.892852-1-kas@kernel.org/t.mbox.gz Breaking thread to remove parents of 20251120165221.892852-1-kas@kernel.org Checking for newer revisions Grabbing search results from lore.kernel.org Analyzing 2 messages in the thread Analyzing 1 code-review messages Checking attestation on all messages, may take a moment... --- ✓ [PATCH] mm/truncate: unmap large folio on split failure --- ✓ Signed: DKIM/kernel.org --- Total patches: 1 --- Applying: mm/truncate: unmap large folio on split failure
Do you have anything on top of v6.17.8 in your 6.17.y queue?
My other backport to 6.17.y doesn't interfere with the patch either.