Re: [PATCH 1/3] mm/hugetlb: Fix race condition of uffd missing/minor handling

From: Peter Xu
Date: Mon Oct 03 2022 - 20:28:17 EST

On Mon, Oct 03, 2022 at 02:45:47PM -0700, Mike Kravetz wrote:
> This also explains why the new locking exposes the race.
> hugetlb_change_protection needs to take the i_mmap_sema in write mode because
> it could unshare pmds. Previously, hugetlb page faults took i_mmap_sema in
> read mode so this race could not happen.

Makes sense, thanks for explaining.

Peter Xu