Re: [PATCHv2 2/2] mm/truncate: Unmap large folio on split failure
From: David Hildenbrand
Date: Fri Oct 24 2025 - 11:44:32 EST
On 23.10.25 11:32, Kiryl Shutsemau wrote:
From: Kiryl Shutsemau <kas@xxxxxxxxxx>
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.
Signed-off-by: Kiryl Shutsemau <kas@xxxxxxxxxx>
---
Thanks!
Acked-by: David Hildenbrand <david@xxxxxxxxxx>
--
Cheers
David / dhildenb