diff options
| author | David Hildenbrand (Arm) <david@kernel.org> | 2026-11-11 22:59:59 +0100 |
|---|---|---|
| committer | David Hildenbrand (Arm) <david@kernel.org> | 2026-11-13 11:14:48 +0100 |
| commit | 169169e26ab498e4a3ee07313e986176f4bc52f0 (patch) | |
| tree | dc23f5ce6383f0d3fe2129269dab4c89efb1f935 /tools/perf/scripts/python | |
| parent | d369ba5a46c65c54b94c94713ca1fb4ad6a87ebf (diff) | |
mm/userfaultfd: fix PTE table overruns in UFFDIO_MOVE
With a folded PMD, pmd_addr_end() simply returns the supplied end.
move_present_ptes() can therefore walk past the source or destination
PTE table during UFFDIO_MOVE.
pmd_addr_end() is only intended for page table traversal, in patterns
like "next = pmd_addr_end(addr, end);". With folded PMDs, a higher level
has already clamped the range to the PTE table.
Folded PMDs are uncommon, but can occur even on arm64, for example
with 64K pages and a 42-bit virtual address space.
Extract the calculation from folio_pte_range() into
pte_table_clamped_end() and use it to clamp both ranges. This preserves
the wraparound handling from commit f681d4580d5c ("mm: fix address
wraparound when scanning large folio PTEs").
Fixes: 50944692052b ("userfaultfd: opportunistic TLB-flush batching for present pages in MOVE")
Cc: stable@vger.kernel.org
Reported-by: Chris Mason <mason@kernel.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Link: https://patch.msgid.link/20261111-pte_table_clamped_end-v1-1-2dbe339c487a@kernel.org
Reviewed-by: Lokesh Gidra <lokeshgidra@google.com>
Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
