Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range
@ 2026-08-19  2:55 Ye Liu
  2026-11-01 22:16 ` patchwork-bot+linux-riscv
  0 siblings, 1 reply; 2+ messages in thread
From: Ye Liu @ 2026-08-19  2:55 UTC (permalink / raw)
  To: Pasha Tatashin, Andrew Morton, Paul Walmsley, Palmer Dabbelt,
	Albert Ou
  Cc: Ye Liu, Alexandre Ghiti, linux-mm, linux-kernel, linux-riscv

From: Ye Liu <liuye@kylinos.cn>

In __page_table_check_pte_clear_range(), the condition to determine
whether to iterate over PTEs only checked pmd_bad() and pmd_leaf().
This relies on the implicit assumption that pmd_none() is always a
subset of pmd_bad() on all architectures supporting PAGE_TABLE_CHECK.

While this assumption currently holds for x86_64, arm64, s390, riscv,
and powerpc, it is an architecture-dependent behavior that may not
hold for future architectures. Add an explicit pmd_none() check to
make the intent clear and avoid calling pte_offset_map() on an empty
PMD, which could lead to undefined behavior.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 mm/page_table_check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_table_check.c b/mm/page_table_check.c
index 6ffc536359cd..ed3e1a76f266 100644
--- a/mm/page_table_check.c
+++ b/mm/page_table_check.c
@@ -278,7 +278,7 @@ void __page_table_check_pte_clear_range(struct mm_struct *mm,
 	if (&init_mm == mm)
 		return;
 
-	if (!pmd_bad(pmd) && !pmd_leaf(pmd)) {
+	if (!pmd_none(pmd) && !pmd_bad(pmd) && !pmd_leaf(pmd)) {
 		pte_t *ptep = pte_offset_map(&pmd, addr);
 		unsigned long i;
 
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESEND PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range
  2026-08-19  2:55 [RESEND PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range Ye Liu
@ 2026-11-01 22:16 ` patchwork-bot+linux-riscv
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+linux-riscv @ 2026-11-01 22:16 UTC (permalink / raw)
  To: Ye Liu
  Cc: linux-riscv, pasha.tatashin, akpm, pjw, palmer, aou, liuye, alex,
	linux-mm, linux-kernel

Hello:

This patch was applied to riscv/linux.git (fixes)
by Andrew Morton <akpm@linux-foundation.org>:

On Wed, 19 Aug 2026 10:55:15 +0800 you wrote:
> From: Ye Liu <liuye@kylinos.cn>
> 
> In __page_table_check_pte_clear_range(), the condition to determine
> whether to iterate over PTEs only checked pmd_bad() and pmd_leaf().
> This relies on the implicit assumption that pmd_none() is always a
> subset of pmd_bad() on all architectures supporting PAGE_TABLE_CHECK.
> 
> [...]

Here is the summary with links:
  - [RESEND] mm/page_table_check: add explicit pmd_none check in pte_clear_range
    https://git.kernel.org/riscv/c/0224133dba05

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-01 22:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19  2:55 [RESEND PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range Ye Liu
2026-11-01 22:16 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox