The original backport didn't move the code to link the vma into the MT and also the code to increment the map_count causing ~15 xfstests (including ext4/303 generic/051 generic/054 generic/069) to hard fail on some platforms. This patch resolves test failures.
Fixes: 0c42f7e039ab ("fork: defer linking file vma until vma is fully initialized") Signed-off-by: Leah Rumancik leah.rumancik@gmail.com --- kernel/fork.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c index 7e9a5919299b..3b44960b1385 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -668,6 +668,15 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, if (is_vm_hugetlb_page(tmp)) hugetlb_dup_vma_private(tmp);
+ /* Link the vma into the MT */ + mas.index = tmp->vm_start; + mas.last = tmp->vm_end - 1; + mas_store(&mas, tmp); + if (mas_is_err(&mas)) + goto fail_nomem_mas_store; + + mm->map_count++; + if (tmp->vm_ops && tmp->vm_ops->open) tmp->vm_ops->open(tmp);
@@ -687,14 +696,6 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, i_mmap_unlock_write(mapping); }
- /* Link the vma into the MT */ - mas.index = tmp->vm_start; - mas.last = tmp->vm_end - 1; - mas_store(&mas, tmp); - if (mas_is_err(&mas)) - goto fail_nomem_mas_store; - - mm->map_count++; if (!(tmp->vm_flags & VM_WIPEONFORK)) retval = copy_page_range(tmp, mpnt);
This is incomplete so please hold off on this patch for now.
On Mon, Jun 3, 2024 at 5:47 PM Leah Rumancik leah.rumancik@gmail.com wrote:
The original backport didn't move the code to link the vma into the MT and also the code to increment the map_count causing ~15 xfstests (including ext4/303 generic/051 generic/054 generic/069) to hard fail on some platforms. This patch resolves test failures.
Fixes: 0c42f7e039ab ("fork: defer linking file vma until vma is fully initialized") Signed-off-by: Leah Rumancik leah.rumancik@gmail.com
kernel/fork.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c index 7e9a5919299b..3b44960b1385 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -668,6 +668,15 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, if (is_vm_hugetlb_page(tmp)) hugetlb_dup_vma_private(tmp);
/* Link the vma into the MT */
mas.index = tmp->vm_start;
mas.last = tmp->vm_end - 1;
mas_store(&mas, tmp);
if (mas_is_err(&mas))
goto fail_nomem_mas_store;
mm->map_count++;
if (tmp->vm_ops && tmp->vm_ops->open) tmp->vm_ops->open(tmp);
@@ -687,14 +696,6 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm, i_mmap_unlock_write(mapping); }
/* Link the vma into the MT */
mas.index = tmp->vm_start;
mas.last = tmp->vm_end - 1;
mas_store(&mas, tmp);
if (mas_is_err(&mas))
goto fail_nomem_mas_store;
mm->map_count++; if (!(tmp->vm_flags & VM_WIPEONFORK)) retval = copy_page_range(tmp, mpnt);
-- 2.45.1.288.g0e0cd299f1-goog
linux-stable-mirror@lists.linaro.org