mm/memory: constrain generic_access_phys() to page boundary
Status from this message: [merged mm-stable] mm-memory-constrain-generic_access_phys-to-page-boundary.patch removed from -mm tree
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest1 patch 5 repliesApplied 1/1
- v21 patch 2 repliesSuperseded
Changes in v3 from the cover letter
- Drop modification to __access_remote_vm(); capping in generic_access_phys() is sufficient because the caller loop already handles partial transfers (David Hildenbrand).
- Drop unnecessary 'len <= 0' check.
- Add comment explaining the single-page limitation (David Hildenbrand).
- v2 Link: https://lore.kernel.org/all/[email protected]/
Patches in v3 All 1 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/1 | mm/memory: constrain generic_access_phys() to page boundarymm/ | +8 | 4 replies | Applied |
Reviews trailers per patch
The patch has a Reviewed-by or Acked-by.
| Patch | David Hildenbrand (Arm) |
|---|---|
| 1/1 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/1] mm/memory: constrain generic_access_phys() to page boundary
From: Luxiao Xu <[email protected]>
Hi all,
This patch addresses an issue in generic_access_phys() where accessing memory across page boundaries in PFNMAP VMAs assumes physical pages are contiguous, which can lead to accessing unintended physical memory or exceeding VMA boundaries.
In v3, we address review feedback from David Hildenbrand on v2:
1. Revert changes to __access_remote_vm(): Capping the access length to (PAGE_SIZE - offset) inside generic_access_phys() is completely sufficient, as __access_remote_vm() already loops over the requested length and handles short transfers.
2. Drop the redundant 'len <= 0' check.
3. Add an explanatory comment clarifying that accesses are limited to one page at a time because follow_pfnmap_start() only validates a single PTE.
4. Regarding min() vs min_t(): min_t(int, ...) is retained because len is a signed int while PAGE_SIZE is unsigned long ((1UL) << PAGE_SHIFT), which triggers a compile-time "signedness error" if plain min() is used.
Thanks for the reviews and guidance.
v2 -> v3:
- Drop modification to __access_remote_vm(); capping in generic_access_phys() is sufficient because the caller loop already handles partial transfers (David Hildenbrand).
- Drop unnecessary 'len <= 0' check.
- Add comment explaining the single-page limitation (David Hildenbrand).
- v2 Link: https://lore.kernel.org/all/[email protected]/
v1 -> v2:
- Drop internal multi-page loop in generic_access_phys(); clamp the chunk size leveraging the existing caller loop (David Hildenbrand).
- Map only PAGE_SIZE in generic_access_phys().
- Add missing (resource_size_t) cast when checking args.pfn (Andrew Morton).
Luxiao Xu (1):
mm/memory: constrain generic_access_phys() to page boundary
mm/memory.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.0