Re: [PATCH v3 4/9] hugetlb/userfaultfd: Unshare all pmds for hugetlbfs when register wp

2021-02-01 Thread Peter Xu
On Mon, Feb 01, 2021 at 02:33:20PM -0800, Mike Kravetz wrote: > On 1/28/21 2:48 PM, Axel Rasmussen wrote: > > From: Peter Xu > > > > Huge pmd sharing for hugetlbfs is racy with userfaultfd-wp because > > userfaultfd-wp is always based on pgtable entries, so they cannot be shared. > > > > Walk th

Re: [PATCH v3 4/9] hugetlb/userfaultfd: Unshare all pmds for hugetlbfs when register wp

2021-02-01 Thread Mike Kravetz
On 1/28/21 2:48 PM, Axel Rasmussen wrote: > From: Peter Xu > > Huge pmd sharing for hugetlbfs is racy with userfaultfd-wp because > userfaultfd-wp is always based on pgtable entries, so they cannot be shared. > > Walk the hugetlb range and unshare all such mappings if there is, right before > UF

[PATCH v3 4/9] hugetlb/userfaultfd: Unshare all pmds for hugetlbfs when register wp

2021-01-28 Thread Axel Rasmussen
From: Peter Xu Huge pmd sharing for hugetlbfs is racy with userfaultfd-wp because userfaultfd-wp is always based on pgtable entries, so they cannot be shared. Walk the hugetlb range and unshare all such mappings if there is, right before UFFDIO_REGISTER will succeed and return to userspace. Thi