linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memory-failure: fix infinite UCE for VM_PFNMAP pfn
@ 2025-08-06  2:05 Jinjiang Tu
  2025-08-06  3:05 ` Miaohe Lin
  2025-08-06 12:39 ` David Hildenbrand
  0 siblings, 2 replies; 10+ messages in thread
From: Jinjiang Tu @ 2025-08-06  2:05 UTC (permalink / raw)
  To: linmiaohe, nao.horiguchi, akpm, xueshuai, david, ziy, osalvador,
	linux-mm
  Cc: wangkefeng.wang, tujinjiang

When memory_failure() is called for a already hwpoisoned pfn,
kill_accessing_process() will be called to kill current task. However, if
the vma of the accessing vaddr is VM_PFNMAP, walk_page_range() will skip
the vma in walk_page_test() and return 0.

Before commit aaf99ac2ceb7 ("mm/hwpoison: do not send SIGBUS to processes
with recovered clean pages"), kill_accessing_process() will return EFAULT.
For x86, the current task will be killed in kill_me_maybe().

However, after this commit, kill_accessing_process() simplies return 0,
that means UCE is handled properly, but it doesn't actually. In such case,
the user task will trigger UCE infinitely.

To fix it, add .test_walk callback for hwpoison_walk_ops to scan all vmas.

Fixes: aaf99ac2ceb7 ("mm/hwpoison: do not send SIGBUS to processes with recovered clean pages")
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
---
 mm/memory-failure.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index b91a33fb6c69..66b0c359d447 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -847,9 +847,16 @@ static int hwpoison_hugetlb_range(pte_t *ptep, unsigned long hmask,
 #define hwpoison_hugetlb_range	NULL
 #endif
 
+static int hwpoison_test_walk(unsigned long start, unsigned long end,
+			     struct mm_walk *walk)
+{
+	return 0;
+}
+
 static const struct mm_walk_ops hwpoison_walk_ops = {
 	.pmd_entry = hwpoison_pte_range,
 	.hugetlb_entry = hwpoison_hugetlb_range,
+	.test_walk = hwpoison_test_walk,
 	.walk_lock = PGWALK_RDLOCK,
 };
 
-- 
2.43.0



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

end of thread, other threads:[~2025-08-09  1:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-06  2:05 [PATCH] mm/memory-failure: fix infinite UCE for VM_PFNMAP pfn Jinjiang Tu
2025-08-06  3:05 ` Miaohe Lin
2025-08-06  3:24   ` Jinjiang Tu
2025-08-06 12:41     ` David Hildenbrand
2025-08-07 11:13       ` Jinjiang Tu
2025-08-08  8:21         ` David Hildenbrand
2025-08-09  1:23           ` Jinjiang Tu
2025-08-06 12:39 ` David Hildenbrand
2025-08-07 11:06   ` Jinjiang Tu
2025-08-08  8:08     ` David Hildenbrand

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