Re: [linux-next:master] [mm] a0f2295a60: WARNING:at_mm/vma.c:#vma_merge_new_range

From: Lorenzo Stoakes
Date: Tue Aug 27 2024 - 07:44:07 EST


On Tue, Aug 27, 2024 at 02:55:45PM GMT, kernel test robot wrote:
>
>
> Hello,
>
> kernel test robot noticed "WARNING:at_mm/vma.c:#vma_merge_new_range" on:
>
> commit: a0f2295a607c0e8a64893593432562444a58a70b ("mm: avoid using vma_merge() for new VMAs")
> https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
>
> in testcase: trinity

[snip]

> [ 28.048325][ T765] ------------[ cut here ]------------
> [ 28.048597][ T765] WARNING: CPU: 0 PID: 765 at mm/vma.c:524 vma_merge_new_range (mm/vma.c:524 (discriminator 1))

Hi, thanks for the report.

For the record this is the following CONFIG_DEBUG_VM check:

/* vmi must point at or before the gap. */
VM_WARN_ON(vma_iter_addr(vmg->vmi) > end);

Which I was able to determine fired due to copy_vma() unnecessarily
advancing the iterator if no previous VMA exists.

I have provided a fix-patch at [0] which should land in -next soon and
resolve this issue.

[0]:https://lore.kernel.org/linux-mm/c0ef6b6a-1c9b-4da2-a180-c8e1c73b1c28@lucifer.local/

[snip]