Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "David Hildenbrand (Arm)" <david@kernel.org>
To: sashiko-reviews@lists.linux.dev,
	Yuanhe Shu <xiangzao@linux.alibaba.com>,
	akpm@linux-foundation.org
Cc: "Huang, Ying" <ying.huang@linux.alibaba.com>,
	Kaitao Cheng <kaitao.cheng@linux.dev>,
	"Garg, Shivank" <shivankg@amd.com>,
	vbabka@kernel.org, ljs@kernel.org, liam@infradead.org,
	rppt@kernel.org, surenb@google.com, mhocko@suse.com,
	linmiaohe@huawei.com, nao.horiguchi@gmail.com, ziy@nvidia.com,
	wangkefeng.wang@huawei.com, tujinjiang@huawei.com,
	mgorman@techsingularity.net, chengkaitao@kylinos.cn,
	muchun.song@linux.dev, linux-mm@kvack.org
Subject: Re: [PATCH v3] mm/highmem: refuse to copy hwpoisoned folios in the !copy_mc fallbacks
Date: Tue, 17 Nov 2026 22:41:19 +0100	[thread overview]
Message-ID: <fffbb241-222c-4e39-8421-cb5468039e7d@kernel.org> (raw)
In-Reply-To: <sashiko-outbox-208876@kernel.org>

On 11/11/26 12:27, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Medium] mm/highmem: missing is_page_hwpoison() check in
>   copy_mc_to_kernel branch
> --
> 
> commit 5b18d6f721e579b691687c6c8c6355f1e1a00b17
> Author: Yuanhe Shu <xiangzao@linux.alibaba.com>
> 
> mm/highmem: refuse to copy hwpoisoned folios in the !copy_mc fallbacks
> 
> This commit checks is_page_hwpoison(from) in the !copy_mc_to_kernel
> fallback implementations of copy_mc_user_highpage() and copy_mc_highpage()
> and returns PAGE_SIZE when the source page is marked hwpoisoned.
> 
> Link: https://lore.kernel.org/r/877bjowf9i.fsf@DESKTOP-5N7EMDA/
> 
>> diff --git a/include/linux/highmem.h b/include/linux/highmem.h
>> index d7aac9de1c8a4..c3240f70471d5 100644
>> --- a/include/linux/highmem.h
>> +++ b/include/linux/highmem.h
>> @@ -473,12 +473,18 @@ static inline int copy_mc_highpage(struct page *to, struct page *from)
>>  static inline int copy_mc_user_highpage(struct page *to, struct page *from,
>>  					unsigned long vaddr, struct vm_area_struct *vma)
>>  {
>> +	/* Don't touch data that is already marked poisoned. */
>> +	if (is_page_hwpoison(from))
>> +		return PAGE_SIZE;
>>  	copy_user_highpage(to, from, vaddr, vma);
>>  	return 0;
>>  }
>>  
>>  static inline int copy_mc_highpage(struct page *to, struct page *from)
>>  {
>> +	/* Don't touch data that is already marked poisoned. */
>> +	if (is_page_hwpoison(from))
>> +		return PAGE_SIZE;
>>  	copy_highpage(to, from);
>>  	return 0;
>>  }
> 
> [Severity: Medium]
> Should the #ifdef copy_mc_to_kernel implementations of
> copy_mc_user_highpage() and copy_mc_highpage() also check
> is_page_hwpoison(from) before mapping and copying the source page?
> 
> copy_mc_to_kernel() only catches hardware exceptions raised during the
> memory read and never inspects page flags. 

I'd leave that out for now. This commit is explicitly about fallbacks.

-- 
Cheers,

David


  reply	other threads:[~2026-11-17 21:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10 11:26 [PATCH v3] mm/highmem: refuse to copy hwpoisoned folios in the !copy_mc fallbacks Yuanhe Shu
2026-11-11  1:54 ` Huang, Ying
2026-11-11  9:36 ` David Hildenbrand (Arm)
2026-11-11 10:14   ` Kefeng Wang
2026-11-11 11:10     ` Weilin Tong
2026-11-11 18:19   ` Catalin Marinas
2026-11-11 11:27 ` sashiko-bot
2026-11-17 21:41   ` David Hildenbrand (Arm) [this message]
2026-11-17 21:42 ` David Hildenbrand (Arm)

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=fffbb241-222c-4e39-8421-cb5468039e7d@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=chengkaitao@kylinos.cn \
    --cc=kaitao.cheng@linux.dev \
    --cc=liam@infradead.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=muchun.song@linux.dev \
    --cc=nao.horiguchi@gmail.com \
    --cc=rppt@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=shivankg@amd.com \
    --cc=surenb@google.com \
    --cc=tujinjiang@huawei.com \
    --cc=vbabka@kernel.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=xiangzao@linux.alibaba.com \
    --cc=ying.huang@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