Re: [PATCH RFC 07/11] mm/mremap: use ptep_get() for the destination PTE

Alexander Gordeev <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel,dev.linux.lists.damon,org.freedesktop.lists.dri-devel,org.freedesktop.lists.intel-gfx,org.kernel.vger.bpf,org.kernel.vger.linux-arch,org.kernel.vger.linux-kernel,org.kernel.vger.linux-parisc,org.kernel.vger.linux-perf-users,org.kernel.vger.linux-trace-kernel,org.kvack.linux-mm,org.xenproject.lists.xen-devel
Message-ID <[email protected]>
On Mon, Jul 27, 2026 at 05:46:58PM +0100, Muhammad Usama Anjum wrote:
> move_ptes() directly dereferences new_ptep when checking that the
> destination slot is empty. new_ptep now points to hw_pte_t table storage,
> while pte_none() consumes a logical pte_t value.
> 
> Read the destination entry through the standard ptep_get() accessor before
> passing the logical value to pte_none().
> 
> Signed-off-by: Muhammad Usama Anjum <[email protected]>
> ---
>  mm/mremap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/mremap.c b/mm/mremap.c
> index d966ee8248b6b..ecb90ccee6fdd 100644
> --- a/mm/mremap.c
> +++ b/mm/mremap.c
> @@ -264,7 +264,7 @@ static int move_ptes(struct pagetable_move_control *pmc,
>  
>  	for (; old_addr < old_end; old_ptep += nr_ptes, old_addr += nr_ptes * PAGE_SIZE,
>  		new_ptep += nr_ptes, new_addr += nr_ptes * PAGE_SIZE) {
> -		VM_WARN_ON_ONCE(!pte_none(*new_ptep));
> +		VM_WARN_ON_ONCE(!pte_none(ptep_get(new_ptep)));

Same as the previous patch, except that I did it already:
https://lore.kernel.org/linux-mm/[email protected]/

>  
>  		nr_ptes = 1;
>  		max_nr_ptes = (old_end - old_addr) >> PAGE_SHIFT;
> -- 
> 2.47.3
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.