[PATCH v1 0/2] mm/hugetlb: fix write-fault handling for shared mappings

From: David Hildenbrand
Date: Fri Aug 05 2022 - 07:03:42 EST


I observed that hugetlb does not support/expect write-faults in shared
mappings that would have to map the R/O-mapped page writable -- and I
found one case where we could currently get such faults and would
erroneously map an anon page into a shared mapping, by triggering
clear_refs to clear soft-dirty tracking at the wrong point in time on a
process.

I propose to backport the fix to stable trees, as the fix for write-notify
should be straight forward.

Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Cc: Muchun Song <songmuchun@xxxxxxxxxxxxx>
Cc: Peter Xu <peterx@xxxxxxxxxx>
Cc: Peter Feiner <pfeiner@xxxxxxxxxx>
Cc: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>

David Hildenbrand (2):
mm/hugetlb: fix hugetlb not supporting write-notify
mm/hugetlb: support write-faults in shared mappings

mm/hugetlb.c | 21 ++++++++++++++-------
mm/mmap.c | 7 +++++++
2 files changed, 21 insertions(+), 7 deletions(-)

--
2.35.3