[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526154850.GA4156@redhat.com>
Date: Mon, 26 May 2025 17:48:51 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Pu Lehui <pulehui@...weicloud.com>
Cc: David Hildenbrand <david@...hat.com>, lorenzo.stoakes@...cle.com,
mhiramat@...nel.org, peterz@...radead.org, Liam.Howlett@...cle.com,
akpm@...ux-foundation.org, vbabka@...e.cz, jannh@...gle.com,
pfalcato@...e.de, linux-mm@...ck.org, linux-kernel@...r.kernel.org,
pulehui@...wei.com
Subject: Re: [RFC PATCH] mm/mmap: Fix uprobe anon page be overwritten when
expanding vma during mremap
Hi Lehui,
As I said, I don't understand mm/, so can't comment, but...
On 05/26, Pu Lehui wrote:
>
> To make things simpler, perhaps we could try post-processing, that is:
>
> diff --git a/mm/mremap.c b/mm/mremap.c
> index 83e359754961..46a757fd26dc 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -240,6 +240,11 @@ static int move_ptes(struct pagetable_move_control
> *pmc,
> if (pte_none(ptep_get(old_pte)))
> continue;
>
> + /* skip move pte when expanded range has uprobe */
> + if (unlikely(pte_present(*new_pte) &&
> + vma_has_uprobes(pmc->new, new_addr, new_addr +
> PAGE_SIZE)))
> + continue;
> +
I was thinking about
WARN_ON(!pte_none(*new_pte))
at the start of the main loop.
Obviously not to fix the problem, but rather to make it more explicit.
This matches the similar xxx_none() checks in the move_pgt_entry() paths,
say, move_normal_pmd().
Oleg.
Powered by blists - more mailing lists