From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
cuibixuan@linux.alibaba.com, baolin.wang@linux.alibaba.com,
zhuo.song@linux.alibaba.com, naoya.horiguchi@nec.com,
akpm@linux-foundation.org
Subject: Re: [PATCH] mm,hwpoison: check mm when killing accessing process
Date: Thu, 15 Sep 2022 10:06:33 +0800 [thread overview]
Message-ID: <a6073325-b575-d991-7bf9-999642e0ca90@linux.alibaba.com> (raw)
In-Reply-To: <51eb9735-349e-db8b-fa1c-096a924ef520@huawei.com>
在 2022/9/15 AM9:45, Miaohe Lin 写道:
> 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@linux.alibaba.com>
>
> Thanks for fixing.
>
> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>
>
> Thanks,
> Miaohe Lin
Thank you for your review.
Cheers,
Shuai
>
>
>> ---
>> 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;
>> }
>>
>>
next prev parent reply other threads:[~2022-09-15 2:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 6:49 Shuai Xue
2022-09-14 22:35 ` Andrew Morton
2022-09-15 1:36 ` Shuai Xue
2022-09-15 1:45 ` Miaohe Lin
2022-09-15 2:06 ` Shuai Xue [this message]
2022-09-15 1:48 ` Naoya Horiguchi
2022-09-15 2:08 ` Shuai Xue
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a6073325-b575-d991-7bf9-999642e0ca90@linux.alibaba.com \
--to=xueshuai@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=cuibixuan@linux.alibaba.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=naoya.horiguchi@nec.com \
--cc=zhuo.song@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox