[PW_SID:977807] [v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap#594
[PW_SID:977807] [v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap#594linux-riscv-bot wants to merge 2 commits into
Conversation
… unmap As pointed out by David[1], the batched unmap logic in try_to_unmap_one() may read past the end of a PTE table when a large folio's PTE mappings are not fully contained within a single page table. While this scenario might be rare, an issue triggerable from userspace must be fixed regardless of its likelihood. This patch fixes the out-of-bounds access by refactoring the logic into a new helper, folio_unmap_pte_batch(). The new helper correctly calculates the safe batch size by capping the scan at both the VMA and PMD boundaries. To simplify the code, it also supports partial batching (i.e., any number of pages from 1 up to the calculated safe maximum), as there is no strong reason to special-case for fully mapped folios. [1] https://lore.kernel.org/linux-mm/a694398c-9f03-4737-81b9-7e49c857fcbe@redhat.com Cc: <stable@vger.kernel.org> Reported-by: David Hildenbrand <david@redhat.com> Closes: https://lore.kernel.org/linux-mm/a694398c-9f03-4737-81b9-7e49c857fcbe@redhat.com Fixes: 354dffd ("mm: support batched unmap for lazyfree large folios during reclamation") Suggested-by: Barry Song <baohua@kernel.org> Acked-by: Barry Song <baohua@kernel.org> Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com> Acked-by: David Hildenbrand <david@redhat.com> Signed-off-by: Lance Yang <lance.yang@linux.dev> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
|
Patch 1: "[v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap" |
a7cb30d to
d776861
Compare
PR for series 977807 applied to workflow__riscv__fixes
Name: [v4,1/1] mm/rmap: fix potential out-of-bounds page table access during batched unmap
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=977807
Version: 4