Skip to content

mm/hugetlb: Fix issues on file sealing and fork

Peter Xu linux-mm lkml stable 2 versions – Applied

Status from this message: [merged] mm-hugetlb-fix-cow-where-page-writtable-in-child.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesApplied 2/2
  2. v12 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Move seal check to be after setting VM_HUGETLB [Mike]
- Rewrite commit message for patch 2, explaining more on why it got broken
- Add r-bs for Mike

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2mm/hugetlb: Fix F_SEAL_FUTURE_WRITEfs/hugetlbfs/inode.c include/linux/mm.h mm/shmem.c+41 -180 repliesApplied
2/2mm/hugetlb: Fix cow where page writtable in childmm/hugetlb.c+1 -00 repliesApplied

Reviews trailers per patch

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

PatchMike Kravetz
1/2R-b
2/2R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/2] mm/hugetlb: Fix issues on file sealing and fork

v2:
- Move seal check to be after setting VM_HUGETLB [Mike]
- Rewrite commit message for patch 2, explaining more on why it got broken
- Add r-bs for Mike

Hugh reported issue with F_SEAL_FUTURE_WRITE not applied correctly to hugetlbfs, which I can easily verify using the memfd_test program, which seems that the program is hardly run with hugetlbfs pages (as by default shmem).

Meanwhile I found another probably even more severe issue on that hugetlb fork won't wr-protect child cow pages, so child can potentially write to parent private pages. Patch 2 addresses that.

After this series applied, "memfd_test hugetlbfs" should start to pass.

Please review, thanks.

Peter Xu (2):
mm/hugetlb: Fix F_SEAL_FUTURE_WRITE mm/hugetlb: Fix cow where page writtable in child

 fs/hugetlbfs/inode.c |  5 +++++
 include/linux/mm.h   | 32 ++++++++++++++++++++++++++++++++
 mm/hugetlb.c         |  1 +
 mm/shmem.c           | 22 ++++------------------
 4 files changed, 42 insertions(+), 18 deletions(-)
Signature · 1 line
2.31.1