[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51eb9735-349e-db8b-fa1c-096a924ef520@huawei.com>
Date: Thu, 15 Sep 2022 09:45:16 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: Shuai Xue <xueshuai@...ux.alibaba.com>
CC: <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
<cuibixuan@...ux.alibaba.com>, <baolin.wang@...ux.alibaba.com>,
<zhuo.song@...ux.alibaba.com>, <naoya.horiguchi@....com>,
<akpm@...ux-foundation.org>
Subject: Re: [PATCH] mm,hwpoison: check mm when killing accessing process
On 2022/9/14 14:49, Shuai Xue wrote:
> 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. Therefore, check mm when killing
> accessing process.
>
> Fixes: a3f5d80ea401 ("mm,hwpoison: send SIGBUS with error virutal address")
> Signed-off-by: Shuai Xue <xueshuai@...ux.alibaba.com>
Thanks for fixing.
Reviewed-by: Miaohe Lin <linmiaohe@...wei.com>
Thanks,
Miaohe Lin
> ---
> mm/memory-failure.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index 14439806b5ef..7553917ce820 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -743,6 +743,9 @@ static int kill_accessing_process(struct task_struct *p, unsigned long pfn,
> };
> 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);
> @@ -751,6 +754,7 @@ static int kill_accessing_process(struct task_struct *p, unsigned long pfn,
> else
> ret = 0;
> mmap_read_unlock(p->mm);
> +
> return ret > 0 ? -EHWPOISON : -EFAULT;
> }
>
>
Powered by blists - more mailing lists