The patch titled Subject: mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v3 has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v3.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v3.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Peter Xu <peterx@xxxxxxxxxx> Subject: mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v3 Date: Fri, 24 Mar 2023 10:26:20 -0400 Link: https://lkml.kernel.org/r/20230324142620.2344140-1-peterx@xxxxxxxxxx Reported-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx> Cc: linux-stable <stable@xxxxxxxxxxxxxxx> Fixes: 166f3ecc0daf ("mm/hugetlb: hook page faults for uffd write protection") Signed-off-by: Peter Xu <peterx@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/mm/hugetlb.c~mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v3 +++ a/mm/hugetlb.c @@ -5491,11 +5491,11 @@ static vm_fault_t hugetlb_wp(struct mm_s * Never handle CoW for uffd-wp protected pages. It should be only * handled when the uffd-wp protection is removed. * - * Note that only the CoW optimization path can trigger this and - * got skipped, because hugetlb_fault() will always resolve uffd-wp - * bit first. + * Note that only the CoW optimization path (in hugetlb_no_page()) + * can trigger this, because hugetlb_fault() will always resolve + * uffd-wp bit first. */ - if (huge_pte_uffd_wp(pte)) + if (!unshare && huge_pte_uffd_wp(pte)) return 0; /* _ Patches currently in -mm which might be from peterx@xxxxxxxxxx are mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path.patch mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v2.patch mm-hugetlb-fix-uffd-wr-protection-for-cow-optimization-path-v3.patch mm-khugepaged-alloc_charge_hpage-take-care-of-mem-charge-errors.patch mm-khugepaged-cleanup-memcg-uncharge-for-failure-path.patch mm-uffd-uffd_feature_wp_unpopulated.patch mm-uffd-uffd_feature_wp_unpopulated-fix.patch selftests-mm-smoke-test-uffd_feature_wp_unpopulated.patch mm-thp-rename-transparent_hugepage_never_dax-to-_unsupported.patch mm-thp-rename-transparent_hugepage_never_dax-to-_unsupported-fix.patch