Re: [PATCH 1/2] hugetlb: really allocate vma lock for all sharable vmas

From: Andrew Morton
Date: Thu Dec 15 2022 - 17:37:14 EST


On Mon, 12 Dec 2022 15:50:41 -0800 Mike Kravetz <mike.kravetz@xxxxxxxxxx> wrote:

> Commit bbff39cc6cbc ("hugetlb: allocate vma lock for all sharable vmas")
> removed the pmd sharable checks in the vma lock helper routines.
> However, it left the functional version of helper routines behind #ifdef
> CONFIG_ARCH_WANT_HUGE_PMD_SHARE. Therefore, the vma lock is not being
> used for sharable vmas on architectures that do not support pmd sharing.
> On these architectures, a potential fault/truncation race is exposed
> that could leave pages in a hugetlb file past i_size until the file is
> removed.
>
> Move the functional vma lock helpers outside the ifdef, and remove the
> non-functional stubs. Since the vma lock is not just for pmd sharing,
> rename the routine __vma_shareable_flags_pmd.
>
> Fixes: bbff39cc6cbc ("hugetlb: allocate vma lock for all sharable vmas")

So I assume we want this backported to 6.1? I added a cc:stable.

The [2/2] patch is, I think, 6.3-rc1 material?