From: Borislav Petkov <firstname.lastname@example.org>
To: "Luck, Tony" <email@example.com>
Cc: firstname.lastname@example.org, email@example.com, firstname.lastname@example.org,
"Andy Lutomirski" <email@example.com>,
"Aili Yao" <firstname.lastname@example.org>,
"HORIGUCHI NAOYA( 堀口 直也)" <email@example.com>
Subject: Re: [PATCH 3/4] mce/copyin: fix to not SIGBUS when copying from user hits poison
Date: Tue, 13 Apr 2021 12:07:22 +0200 [thread overview]
Message-ID: <20210413100722.GC16519@zn.tnic> (raw)
On Thu, Apr 08, 2021 at 10:08:52AM -0700, Luck, Tony wrote:
> Also not clear to me either ... but sending a SIGBUS to a kthread isn't
> going to do anything useful. So avoiding doing that is another worthy
> With these patches nothing gets killed when kernel touches user poison.
> If this is in a regular system call then these patches will return EFAULT
> to the user (but now that I see EHWPOISON exists that looks like a better
> choice - so applications can distinguish the "I just used an invalid address in
> a parameter to a syscall" from "This isn't my fault, the memory broke".
Yap, makes sense.
> KVM apparently passes a machine check into the guest.
Ah, there it is:
static void kvm_send_hwpoison_signal(unsigned long address, struct task_struct *tsk)
send_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, PAGE_SHIFT, tsk);
> Though it seems to be misisng the MCG_STATUS information to tell
> the guest whether this is an "Action Required" machine check, or an
> "Action Optional" (i.e. whether the poison was found synchonously by
> execution of the current instruction, or asynchronously).
Yeah, someone needs to deal with that sooner or later, considering how
virt is becoming ubiquitous.
> There is the ancient Documentation/vm/hwpoison.rst from 2009 ... nothing
> seems wrong in that, but could use some updates.
Ah yap, that.
So what I'm missing with all this fun is, yeah, sure, we have this
facility out there but who's using it? Is anyone even using it at all?
If so, does it even make sense, does it need improvements, etc?
Because from where I stand it all looks like we do all these fancy
recovery things but is userspace even paying attention or using them or
> I don't know how much detail we might want to go into on recovery
> stratgies for applications.
Perhaps an example or two how userspace is supposed to use it...
> In terms of production s/w there was one ISV who prototyped recovery
> for their application but last time I checked didn't enable it in the
> production version.
See, one and it hasn't even enabled it. So it all feels like a lot of
wasted energy to me to do all those and keep 'em working. But maybe I'm
missing the big picture and someone would come and say, no, Boris, we
use this and this and that is our feedback...
> Essentially it boils down to:
> SIGBUS handler gets additional data giving virtual address that has gone away
> 1) Can the application replace the lost page?
> Use mmap(addr, MAP_FIXED, ...) to map a fresh page into the gap
> and fill with replacement data. This case can return from SIGBUS
> handler to re-execute failed instruction
> 2) Can the application continue in degraded mode w/o the lost page?
> Hunt down pointers to lost page and update structures to say
> "this data lost". Use siglongjmp() to go to preset recovery path
> 3) Can the application shut down gracefully?
> Record details of the lost page. Inform next-of-kin. Exit.
> 4) Default - just exit
Right and this should probably start with "Hey userspace folks, here's
what you can do when you get a hwpoison signal and here's how we
envision this recovery to work" and then we can all discuss and converge
on an agreeable solution which is actually used and there will be
selftests and so on and so on...
But what the h*ll do I know.
next prev parent reply other threads:[~2021-04-13 10:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-26 0:02 [RFC 0/4] Fix machine check recovery for copy_from_user Tony Luck
2021-03-26 0:02 ` [PATCH 1/4] x86/mce: Fix copyin code to return -EFAULT on machine check Tony Luck
2021-04-06 19:24 ` Borislav Petkov
2021-03-26 0:02 ` [PATCH 2/4] mce/iter: Check for copyin failure & return error up stack Tony Luck
2021-03-26 0:02 ` [PATCH 3/4] mce/copyin: fix to not SIGBUS when copying from user hits poison Tony Luck
2021-04-07 21:18 ` Borislav Petkov
2021-04-07 21:43 ` Luck, Tony
2021-04-08 8:49 ` Borislav Petkov
2021-04-08 17:08 ` Luck, Tony
2021-04-13 10:07 ` Borislav Petkov [this message]
2021-04-13 16:13 ` Luck, Tony
2021-04-14 13:05 ` Borislav Petkov
2021-03-26 0:02 ` [PATCH 4/4] x86/mce: Avoid infinite loop for copy from user recovery Tony Luck
2021-04-08 13:36 ` Borislav Petkov
2021-04-08 16:06 ` Luck, Tony
2021-04-08 2:13 ` [RFC 0/4] Fix machine check recovery for copy_from_user Aili Yao
2021-04-08 14:39 ` Luck, Tony
2021-04-09 6:49 ` Aili Yao
2021-04-14 5:47 [PATCH 3/4] mce/copyin: fix to not SIGBUS when copying from user hits poison Jue Wang
2021-04-14 13:10 ` Borislav Petkov
2021-04-14 14:46 ` Jue Wang
2021-04-14 15:35 ` Borislav Petkov
2021-04-19 20:32 Jue Wang
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:
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
* 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;
as well as URLs for NNTP newsgroup(s).