[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250529121944.3612511aa540b9711657e05a@linux-foundation.org>
Date: Thu, 29 May 2025 12:19:44 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Pu Lehui <pulehui@...weicloud.com>
Cc: mhiramat@...nel.org, oleg@...hat.com, peterz@...radead.org,
Liam.Howlett@...cle.com, lorenzo.stoakes@...cle.com, vbabka@...e.cz,
jannh@...gle.com, pfalcato@...e.de, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, stable@...r.kernel.org, pulehui@...wei.com
Subject: Re: [PATCH v1 2/4] mm: Expose abnormal new_pte during move_ptes
On Thu, 29 May 2025 15:56:48 +0000 Pu Lehui <pulehui@...weicloud.com> wrote:
> From: Pu Lehui <pulehui@...wei.com>
>
> When executing move_ptes, the new_pte must be NULL, otherwise it will be
> overwritten by the old_pte, and cause the abnormal new_pte to be leaked.
> In order to make this problem to be more explicit, let's add
> WARN_ON_ONCE when new_pte is not NULL.
>
> ...
>
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -237,6 +237,8 @@ static int move_ptes(struct pagetable_move_control *pmc,
>
> for (; old_addr < old_end; old_pte++, old_addr += PAGE_SIZE,
> new_pte++, new_addr += PAGE_SIZE) {
> + WARN_ON_ONCE(!pte_none(*new_pte));
> +
> if (pte_none(ptep_get(old_pte)))
> continue;
>
We now have no expectation that this will trigger, yes? It's a sanity
check that patch [1/4] is working? Perhaps VM_WARN_ON_ONCE() would be
more appropriate. And maybe even a comment:
/* temporary, remove this one day */
Powered by blists - more mailing lists