Skip to contentSkip to conversation

mmhwpoison-check-mm-when-killing-accessing-process.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Sep 26, 2022 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm,hwpoison: check mm when killing accessing process
has been removed from the -mm tree. Its filename was
mmhwpoison-check-mm-when-killing-accessing-process.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Shuai Xue <[email protected]>
Subject: mm,hwpoison: check mm when killing accessing process
Date: Wed, 14 Sep 2022 14:49:35 +0800

The GHES code calls memory_failure_queue() from IRQ context to queue work into workqueue and schedule it on the current CPU. Then the work is processed in memory_failure_work_func() by kworker and calls memory_failure().

When a page is already poisoned, commit a3f5d80ea401 ("mm,hwpoison: send SIGBUS with error virutal address") make memory_failure() call kill_accessing_process() that:

- holds mmap locking of current->mm
- does pagetable walk to find the error virtual address
- and sends SIGBUS to the current process with error info.

However, the mm of kworker is not valid, resulting in a null-pointer dereference. So check mm when killing the accessing process.

[[email protected]: remove unrelated whitespace alteration]
Fixes a3f5d80ea401 ("mm,hwpoison: send SIGBUS with error virutal address")
Cc Huang Ying <[email protected]>
Cc Baolin Wang <[email protected]>
Cc Bixuan Cui <[email protected]>

---

 mm/memory-failure.c |    3 +++
 1 file changed, 3 insertions(+)
mm/memory-failure.c renamed from mm/memory-failure.c~mmhwpoison-check-mm-when-killing-accessing-process +3 -0
@@ -745,6 +745,9 @@ static int kill_accessing_process(struct
 	};
 	priv.tk.tsk = p;
 
+	if (!p->mm)
+		return -EFAULT;
+
 	mmap_read_lock(p->mm);
 	ret = walk_page_range(p->mm, 0, TASK_SIZE, &hwp_walk_ops,
 			      (void *)&priv);

_

Patches currently in -mm which might be from [email protected] are