[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <r53padg4hfieimmrwryhkhdfnzaxyeas5uau7id5iszc3ug4ps@3mm7yxoqkgzk>
Date: Thu, 31 Oct 2024 13:04:38 -0400
From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>
Subject: Re: [PATCH] vma: Detect infinite loop in vma tree
* Liam R. Howlett <Liam.Howlett@...cle.com> [241031 13:01]:
> From: "Liam R. Howlett" <Liam.Howlett@...cle.com>
>
> There have been no reported infinite loops in the tree, but checking the
> detection of an infinite loop during validation is simple enough. Add
> the detection to the validate_mm() function so that error reports are
> clear and don't just report stalls.
>
> This does not protect against internal maple tree issues, but it does
> detect too many vmas being returned from the tree.
I should add:
This patch does have the downside of making the count difference less
useful (we will only see one extra as apposed to what may exist).
>
> Signed-off-by: Liam R. Howlett <Liam.Howlett@...cle.com>
> Cc: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
> Cc: Vlastimil Babka <vbabka@...e.cz>
> Cc: Jann Horn <jannh@...gle.com>
> ---
> mm/vma.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/vma.c b/mm/vma.c
> index 68138e8c153e..60ed8cc187ad 100644
> --- a/mm/vma.c
> +++ b/mm/vma.c
> @@ -615,7 +615,8 @@ void validate_mm(struct mm_struct *mm)
> anon_vma_unlock_read(anon_vma);
> }
> #endif
> - i++;
> + if (++i > mm->map_count)
> + break;
> }
> if (i != mm->map_count) {
> pr_emerg("map_count %d vma iterator %d\n", mm->map_count, i);
> --
> 2.43.0
>
Powered by blists - more mailing lists