The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] docs/zh_CN: sync page_table_check.rst translation
@ 2026-08-05 12:22 Ye Liu
  2026-08-05 12:22 ` [PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range Ye Liu
  2026-08-05 13:13 ` [PATCH] docs/zh_CN: sync page_table_check.rst translation Dongliang Mu
  0 siblings, 2 replies; 3+ messages in thread
From: Ye Liu @ 2026-08-05 12:22 UTC (permalink / raw)
  To: Alex Shi, Yanteng Si, Jonathan Corbet
  Cc: Ye Liu, Dongliang Mu, Shuah Khan, Randy Dunlap, linux-doc,
	linux-kernel

From: Ye Liu <liuye@kylinos.cn>

Update the Chinese translation of page_table_check.rst to reflect
two changes in the English original:

1. "In case of detected corruption" → "In case of most detected
   corruption" — clarify that not all corruption types cause a crash.

2. Add the missing paragraph about page table entry flag checks and
   userfaultfd wr-protect verification.

Signed-off-by: Ye Liu <liuye@kylinos.cn>
---
 .../translations/zh_CN/mm/page_table_check.rst         | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/translations/zh_CN/mm/page_table_check.rst b/Documentation/translations/zh_CN/mm/page_table_check.rst
index dc34570dceff..7ba5a39db487 100644
--- a/Documentation/translations/zh_CN/mm/page_table_check.rst
+++ b/Documentation/translations/zh_CN/mm/page_table_check.rst
@@ -21,9 +21,13 @@
 当新的页面可以从用户空间访问时,页表检查通过将它们的页表项(PTEs PMD等)添加到页表中来执行额外
 的验证。
 
-在检测到损坏的情况下,内核会被崩溃。页表检查有一个小的性能和内存开销。因此,它在默认情况下是禁用
-的,但是在额外的加固超过性能成本的系统上,可以选择启用。另外,由于页表检查是同步的,它可以帮助调
-试双映射内存损坏问题,在错误的映射发生时崩溃内核,而不是在内存损坏错误发生后内核崩溃。
+在检测到大多数类型的损坏时,内核会崩溃。页表检查有一个小的性能和内存开销。因此,它在默认情况下是
+禁用的,但是在额外的加固超过性能成本的系统上,可以选择启用。另外,由于页表检查是同步的,它可以帮
+助调试双映射内存损坏问题,在错误的映射发生时崩溃内核,而不是在内存损坏错误发生后内核崩溃。
+
+页表检查还可用于对各种标志进行页表项检查,在检测到非法的标志组合时输出警告。目前,userfaultfd 是
+唯一的使用者,用于对 wr-protect 位与任何可写标志进行一致性检查。在这种情况下,非法的标志组合不会
+立即直接导致数据损坏,但会使只读数据变为可写,从而在后续修改页面内容时导致损坏。
 
 双重映射检测逻辑
 ================
-- 
2.25.1


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

* [PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range
  2026-08-05 12:22 [PATCH] docs/zh_CN: sync page_table_check.rst translation Ye Liu
@ 2026-08-05 12:22 ` Ye Liu
  2026-08-05 13:13 ` [PATCH] docs/zh_CN: sync page_table_check.rst translation Dongliang Mu
  1 sibling, 0 replies; 3+ messages in thread
From: Ye Liu @ 2026-08-05 12:22 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


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

* Re: [PATCH] docs/zh_CN: sync page_table_check.rst translation
  2026-08-05 12:22 [PATCH] docs/zh_CN: sync page_table_check.rst translation Ye Liu
  2026-08-05 12:22 ` [PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range Ye Liu
@ 2026-08-05 13:13 ` Dongliang Mu
  1 sibling, 0 replies; 3+ messages in thread
From: Dongliang Mu @ 2026-08-05 13:13 UTC (permalink / raw)
  To: Ye Liu, Alex Shi, Yanteng Si, Jonathan Corbet
  Cc: Ye Liu, Shuah Khan, Randy Dunlap, linux-doc, linux-kernel


On 8/5/26 8:22 PM, Ye Liu wrote:
> From: Ye Liu <liuye@kylinos.cn>
>
> Update the Chinese translation of page_table_check.rst to reflect
> two changes in the English original:
>
> 1. "In case of detected corruption" → "In case of most detected
>     corruption" — clarify that not all corruption types cause a crash.
>
> 2. Add the missing paragraph about page table entry flag checks and
>     userfaultfd wr-protect verification.

Please take a look at how-to.rst [1] and rewrite the commit message.

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/translations/zh_CN/how-to.rst.

Dongliang Mu

>
> Signed-off-by: Ye Liu <liuye@kylinos.cn>
> ---
>   .../translations/zh_CN/mm/page_table_check.rst         | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/translations/zh_CN/mm/page_table_check.rst b/Documentation/translations/zh_CN/mm/page_table_check.rst
> index dc34570dceff..7ba5a39db487 100644
> --- a/Documentation/translations/zh_CN/mm/page_table_check.rst
> +++ b/Documentation/translations/zh_CN/mm/page_table_check.rst
> @@ -21,9 +21,13 @@
>   当新的页面可以从用户空间访问时,页表检查通过将它们的页表项(PTEs PMD等)添加到页表中来执行额外
>   的验证。
>   
> -在检测到损坏的情况下,内核会被崩溃。页表检查有一个小的性能和内存开销。因此,它在默认情况下是禁用
> -的,但是在额外的加固超过性能成本的系统上,可以选择启用。另外,由于页表检查是同步的,它可以帮助调
> -试双映射内存损坏问题,在错误的映射发生时崩溃内核,而不是在内存损坏错误发生后内核崩溃。
> +在检测到大多数类型的损坏时,内核会崩溃。页表检查有一个小的性能和内存开销。因此,它在默认情况下是
> +禁用的,但是在额外的加固超过性能成本的系统上,可以选择启用。另外,由于页表检查是同步的,它可以帮
> +助调试双映射内存损坏问题,在错误的映射发生时崩溃内核,而不是在内存损坏错误发生后内核崩溃。
> +
> +页表检查还可用于对各种标志进行页表项检查,在检测到非法的标志组合时输出警告。目前,userfaultfd 是
> +唯一的使用者,用于对 wr-protect 位与任何可写标志进行一致性检查。在这种情况下,非法的标志组合不会
> +立即直接导致数据损坏,但会使只读数据变为可写,从而在后续修改页面内容时导致损坏。
>   
>   双重映射检测逻辑
>   ================


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

end of thread, other threads:[~2026-08-05 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-05 12:22 [PATCH] docs/zh_CN: sync page_table_check.rst translation Ye Liu
2026-08-05 12:22 ` [PATCH] mm/page_table_check: add explicit pmd_none check in pte_clear_range Ye Liu
2026-08-05 13:13 ` [PATCH] docs/zh_CN: sync page_table_check.rst translation Dongliang Mu

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