From: Jinjiang Tu <tujinjiang@huawei.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: <wangkefeng.wang@huawei.com>, <nao.horiguchi@gmail.com>,
<akpm@linux-foundation.org>, <xueshuai@linux.alibaba.com>,
<david@redhat.com>, <ziy@nvidia.com>, <osalvador@suse.de>,
<linux-mm@kvack.org>
Subject: Re: [PATCH] mm/memory-failure: fix infinite UCE for VM_PFNMAP pfn
Date: Wed, 6 Aug 2025 11:24:46 +0800 [thread overview]
Message-ID: <35e24029-d58c-47e8-b5fe-e182f143ebff@huawei.com> (raw)
In-Reply-To: <1e63c37f-8eb2-865d-d3f4-9ef928f1a959@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1859 bytes --]
在 2025/8/6 11:05, Miaohe Lin 写道:
> On 2025/8/6 10:05, Jinjiang Tu wrote:
>> When memory_failure() is called for a already hwpoisoned pfn,
>> kill_accessing_process() will be called to kill current task. However, if
> Thanks for your patch.
>
>> 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.
> I'm not sure but pfn_to_online_page should return NULL for VM_PFNMAP pages?
> So memory_failure_dev_pagemap should handle these pages?
We could call remap_pfn_range() for those pfns with struct page. IIUC, VM_PFNMAP
means we should assume the pfn doesn't have struct page, but it can have.
>
>> 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.
> Did you ever trigger this loop?
Yes. Our test is as follow steps:
1) create a user task allocates a clean anonymous page, wihout accessing it.
2) use einj to inject UCE for the page
3) create task devmem to use /dev/mem to map the pfn and keep accessing it.
/dev/mem uses remap_pfn_range() to map the pfn.
When task devmem first accesses the pfn, UCE is triggered, memory_failure()
succeeds to isolate it due to it's clean user page. But the task devmem isn't killed.
When task devmem accesses the pfn again, since the pfn is already hwpoisoned, kill_accessing_process() is called.
But it fails to kill the accessing task.
Theoretically, if we have several tasks that share the pfn range mapped by remap_pfn_range(), the above issue exists too.
>
> Thanks.
> .
[-- Attachment #2: Type: text/html, Size: 2975 bytes --]
next prev parent reply other threads:[~2025-08-06 3:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-06 2:05 Jinjiang Tu
2025-08-06 3:05 ` Miaohe Lin
2025-08-06 3:24 ` Jinjiang Tu [this message]
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
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=35e24029-d58c-47e8-b5fe-e182f143ebff@huawei.com \
--to=tujinjiang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-mm@kvack.org \
--cc=nao.horiguchi@gmail.com \
--cc=osalvador@suse.de \
--cc=wangkefeng.wang@huawei.com \
--cc=xueshuai@linux.alibaba.com \
--cc=ziy@nvidia.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