linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pu Lehui <pulehui@huaweicloud.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: mhiramat@kernel.org, oleg@redhat.com, peterz@infradead.org,
	Liam.Howlett@oracle.com, lorenzo.stoakes@oracle.com,
	vbabka@suse.cz, jannh@google.com, pfalcato@suse.de,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, pulehui@huawei.com
Subject: Re: [PATCH v1 2/4] mm: Expose abnormal new_pte during move_ptes
Date: Fri, 30 May 2025 09:24:54 +0800	[thread overview]
Message-ID: <263929f5-bde6-48fb-a162-298a9f83bf5b@huaweicloud.com> (raw)
In-Reply-To: <20250529121944.3612511aa540b9711657e05a@linux-foundation.org>



On 2025/5/30 3:19, Andrew Morton wrote:
> On Thu, 29 May 2025 15:56:48 +0000 Pu Lehui <pulehui@huaweicloud.com> wrote:
> 
>> From: Pu Lehui <pulehui@huawei.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

Hi Andrew,

This can sanitize abnormal new_pte. It is expected that uprobe would not 
come in later, but others, uncertain🤔? So it will be a good alert. And 
after patch 1 it will not trigger WARNING.

> check that patch [1/4] is working?  Perhaps VM_WARN_ON_ONCE() would be

Agree, should I respin one more?

> more appropriate.  And maybe even a comment:
> 
> 	/* temporary, remove this one day */
> 



  reply	other threads:[~2025-05-30  1:25 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-29 15:56 [PATCH v1 0/4] Fix uprobe pte be overwritten when expanding vma Pu Lehui
2025-05-29 15:56 ` [PATCH v1 1/4] mm: " Pu Lehui
2025-05-30  9:28   ` Lorenzo Stoakes
2025-05-30 18:51   ` David Hildenbrand
2025-06-02 11:55     ` Lorenzo Stoakes
2025-06-02 12:26       ` David Hildenbrand
2025-06-02 13:26         ` Lorenzo Stoakes
2025-06-02 16:28           ` David Hildenbrand
2025-06-02 17:01             ` Lorenzo Stoakes
2025-06-03 12:16               ` David Hildenbrand
2025-06-04  1:51                 ` Andrew Morton
2025-05-29 15:56 ` [PATCH v1 2/4] mm: Expose abnormal new_pte during move_ptes Pu Lehui
2025-05-29 19:19   ` Andrew Morton
2025-05-30  1:24     ` Pu Lehui [this message]
2025-05-30  3:47       ` Andrew Morton
2025-05-30 10:21   ` Lorenzo Stoakes
2025-05-30 16:44     ` Oleg Nesterov
2025-05-29 15:56 ` [PATCH v1 3/4] selftests/mm: Extract read_sysfs and write_sysfs into vm_util Pu Lehui
2025-05-30 11:48   ` Lorenzo Stoakes
2025-06-03  7:17     ` Pu Lehui
2025-06-04  2:36       ` Andrew Morton
2025-06-04  8:21         ` Pu Lehui
2025-05-29 15:56 ` [PATCH v1 4/4] selftests/mm: Add test about uprobe pte be orphan during vma merge Pu Lehui
2025-05-30 11:32   ` Lorenzo Stoakes
2025-06-03  7:08     ` Pu Lehui
2025-06-03  9:56       ` Lorenzo Stoakes
2025-06-10 10:37   ` Aishwarya
2025-06-10 11:27     ` Pedro Falcato
2025-06-10 11:34       ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=263929f5-bde6-48fb-a162-298a9f83bf5b@huaweicloud.com \
    --to=pulehui@huaweicloud.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=jannh@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.com \
    --cc=mhiramat@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pfalcato@suse.de \
    --cc=pulehui@huawei.com \
    --cc=stable@vger.kernel.org \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).