Skip to content

Fix incorrect access of hugetlb pte entries

Dev Jain linux-arm-kernel linux-mm lkml stable 3 versions – Applied

Status from this message: [merged mm-stable] mm-mprotect-use-huge_ptep_get-for-hugetlb.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 20 repliesApplied 6/6
  2. v26 patches 17 repliesSuperseded
  3. v15 patches 33 repliesSuperseded

Changes in v3 from the cover letter

- Place comment at appropriate place in patches 2 and 3
- Modify indentation in patch 2, patch 6

Patches in v3 All 6 applied

#Subject and filesSizeRepliesApplied
1/6arm64: make huge_ptep_get handled unaligned addressesarch/arm64/mm/hugetlbpage.c+1 -18 repliesApplied
2/6mm/rmap: use huge_ptep_get() in try_to_unmap_one()include/linux/hugetlb.h mm/rmap.c+12 -62 repliesApplied
3/6mm/rmap: use huge_ptep_get() in try_to_migrate_one()mm/rmap.c+10 -61 replyApplied
4/6mm/migrate: use huge_ptep_get() in remove_migration_pte()mm/migrate.c+5 -10 repliesApplied
5/6mm/page_vma_mapped: use huge_ptep_get() for hugetlbmm/page_vma_mapped.c+7 -10 repliesApplied
6/6mm/mprotect: use huge_ptep_get() for hugetlbmm/mprotect.c+9 -33 repliesApplied

Reviews trailers per patch

All 6 patches have a Reviewed-by or Acked-by.

PatchDavid Hildenbrand (Arm)Muchun Song
1/6A-b A-b
2/6A-b R-b
3/6A-b A-b
4/6A-b A-b
5/6A-b R-b
6/6A-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/6] Fix incorrect access of hugetlb pte entries

There are various places which use ptep_get() to get the pte entry corresponding to a hugetlb folio. Some arches (like s390) have special handling to compute the pteval, so they provide huge_ptep_get(). Use this helper consistently.

Additionally, some code paths may provide huge_ptep_get with an unaligned address. This is a problem on arm64 (I checked other arches and it looks fine for them), which is fixed in patch 1. The fix is made to be
backport-friendly: the cleaner fix would be to perhaps pass the hstate to huge_ptep_get() - that is wider churn and we can do that later.

---
v2->v3:
- Place comment at appropriate place in patches 2 and 3
- Modify indentation in patch 2, patch 6

v1->v2:
- Add patch 1
- Mention s390 in cover letter

Dev Jain (6):
arm64: make huge_ptep_get handled unaligned addresses mm/rmap: use huge_ptep_get() in try_to_unmap_one() mm/rmap: use huge_ptep_get() in try_to_migrate_one() mm/migrate: use huge_ptep_get() in remove_migration_pte() mm/page_vma_mapped: use huge_ptep_get() for hugetlb mm/mprotect: use huge_ptep_get() for hugetlb

 arch/arm64/mm/hugetlbpage.c |  2 +-
 include/linux/hugetlb.h     |  2 ++
 mm/migrate.c                |  6 +++++-
 mm/mprotect.c               | 12 +++++++++---
 mm/page_vma_mapped.c        |  8 +++++++-
 mm/rmap.c                   | 32 ++++++++++++++++++++------------
 6 files changed, 44 insertions(+), 18 deletions(-)
Signature · 1 line
2.43.0