From: Zi Yan <ziy@nvidia.com>
To: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
Cc: David Hildenbrand <david@kernel.org>,
Miaohe Lin <linmiaohe@huawei.com>,
Usama Arif <usama.arif@linux.dev>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
kernel-team@meta.com, stable@vger.kernel.org
Subject: Re: [PATCH] mm/memory: don't map hardware-poisoned pages in finish_fault()
Date: Thu, 19 Nov 2026 09:26:28 -0500 [thread overview]
Message-ID: <60EB5A48-93F8-47DC-85C5-C83A60A72083@nvidia.com> (raw)
In-Reply-To: <20261119134236.3745231-1-kas@kernel.org>
On 19 Nov 2026, at 8:42, Kiryl Shutsemau (Meta) wrote:
> When memory_failure() cannot split a large file folio, the folio stays in
> the page cache with the poisoned page in it. do_set_pmd() refuses to map
> such a folio with a PMD, so that the poisoned page gets its own fault and
> SIGBUS. finish_fault() then falls back to PTEs, but maps the whole folio:
>
> do_shared_fault()
> __do_fault()
> PageHWPoison(vmf->page)
> // the faulting page only
> finish_fault()
> do_set_pmd()
> // backs off on has_hwpoisoned
> set_pte_range(vmf, folio, &folio->page, folio_nr_pages(folio), ...)
> // maps the poisoned page as well
>
> A process that touches the poisoned page takes a machine check instead
> of SIGBUS from the fault.
>
> Map a folio with a poisoned page one page at a time. The poisoned page
> then takes its own fault, which __do_fault() turns into SIGBUS.
>
> Fixes: 43e027e41423 ("mm: memory: extend finish_fault() to support large folio")
> Cc: stable@vger.kernel.org
> Signed-off-by: Kiryl Shutsemau (Meta) <kas@kernel.org>
> ---
> Found while reviewing Usama's fix for the swap-in side:
> https://patch.msgid.link/20261116063624.1382944-3-usama.arif@linux.dev
>
> Reproduced on a huge=always tmpfs, with a THP that vmsplice() keeps
> memory_failure() from splitting. A write fault on a good page of the
> folio maps all 512 PTEs, the poisoned page included. With the patch it
> maps the faulting page only.
>
> mm/memory.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
LGTM. Thanks.
Reviewed-by: Zi Yan <ziy@nvidia.com>
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2026-11-19 14:26 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-19 13:42 [PATCH] mm/memory: don't map hardware-poisoned pages in finish_fault() Kiryl Shutsemau (Meta)
2026-11-19 14:26 ` Zi Yan [this message]
2026-11-19 16:45 ` David Hildenbrand (Arm)
2026-11-19 16:45 ` 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=60EB5A48-93F8-47DC-85C5-C83A60A72083@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=kas@kernel.org \
--cc=kernel-team@meta.com \
--cc=liam@infradead.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=nao.horiguchi@gmail.com \
--cc=rppt@kernel.org \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=wangkefeng.wang@huawei.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