linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: Borislav Petkov <bp@alien8.de>
Cc: Shuai Xue <xueshuai@linux.alibaba.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"catalin.marinas@arm.com" <catalin.marinas@arm.com>,
	"yazen.ghannam@amd.com" <yazen.ghannam@amd.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linmiaohe@huawei.com" <linmiaohe@huawei.com>,
	"nao.horiguchi@gmail.com" <nao.horiguchi@gmail.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"jpoimboe@kernel.org" <jpoimboe@kernel.org>,
	"linux-edac@vger.kernel.org" <linux-edac@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"baolin.wang@linux.alibaba.com" <baolin.wang@linux.alibaba.com>,
	"tianruidong@linux.alibaba.com" <tianruidong@linux.alibaba.com>
Subject: RE: [PATCH v4 1/3] x86/mce: Use is_copy_from_user() to determine copy-from-user context
Date: Fri, 7 Mar 2025 23:11:26 +0000	[thread overview]
Message-ID: <SJ1PR11MB6083223A3175F7A84EC4DDDFFCD52@SJ1PR11MB6083.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20250307224645.GKZ8t3VX5a5FhqNyZG@fat_crate.local>

> > is_copy_from_user() decodes the instruction that took the trap. It looks for
> > MOV, MOVZ and MOVS instructions to find the source address, and then
> > checks whether that's user (< TASK_SIZE_MAX) or kernel.
>
> You mean there's absolutely nothing else like, say, some epbf or some other
> hackery we tend to do in the kernel (or we will do in the future) which won't
> create the exact same two conditions:
>
> - one of the three insns
> - user mem read
>
> and it would cause a recovery action.
>
> Perhaps it still might be the proper thing to do even then but it does sound
> fishy and unclean to me.
>
> Nothing beats the explicit markup we had until recently...

Every "user mem read" needs to have an extable[] recovery entry
attached to the IP of the instruction  (to handle the much more common
#PF for page-not-present). All those places already have to deal with
the possibility that the #PF can't be recovered. The #MC handling is
really just a small extension.

As for "explicit markup" I don't think it would be better to decorate
every get_user() and copy_from_user() with some "this one can
recover from #MC" 

Note also that "what we had recently" was fragile, broke, and resulted
in this regression.

-Tony

  reply	other threads:[~2025-03-07 23:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07  5:44 [PATCH v4 0/3] mm/hwpoison: Fix regressions in memory failure handling Shuai Xue
2025-03-07  5:44 ` [PATCH v4 1/3] x86/mce: Use is_copy_from_user() to determine copy-from-user context Shuai Xue
2025-03-07 20:40   ` Borislav Petkov
2025-03-07 22:05     ` Luck, Tony
2025-03-07 22:46       ` Borislav Petkov
2025-03-07 23:11         ` Luck, Tony [this message]
2025-03-07 23:22           ` Borislav Petkov
2025-03-08 11:27             ` Shuai Xue
2025-03-08 11:25     ` Shuai Xue
2025-03-07  5:44 ` [PATCH v4 2/3] mm/hwpoison: Do not send SIGBUS to processes with recovered clean pages Shuai Xue
2025-03-12  6:39   ` Miaohe Lin
2025-03-12  8:03     ` Shuai Xue
2025-03-07  5:44 ` [PATCH v4 3/3] mm: memory-failure: Enhance comments for return value of memory_failure() Shuai Xue
2025-03-07 17:20 ` [PATCH v4 0/3] mm/hwpoison: Fix regressions in memory failure handling Luck, Tony
2025-03-08 11:36   ` Shuai Xue
2025-03-12 11:28 Shuai Xue
2025-03-12 11:28 ` [PATCH v4 1/3] x86/mce: Use is_copy_from_user() to determine copy-from-user context 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=SJ1PR11MB6083223A3175F7A84EC4DDDFFCD52@SJ1PR11MB6083.namprd11.prod.outlook.com \
    --to=tony.luck@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=linmiaohe@huawei.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=nao.horiguchi@gmail.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tianruidong@linux.alibaba.com \
    --cc=x86@kernel.org \
    --cc=xueshuai@linux.alibaba.com \
    --cc=yazen.ghannam@amd.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