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 */