From: Aili Yao <yaoaili@kingsoft.com>
To: "HORIGUCHI NAOYA(堀口 直也)" <naoya.horiguchi@nec.com>
Cc: "tony.luck@intel.com" <tony.luck@intel.com>,
"dave.hansen@linux.intel.com" <dave.hansen@linux.intel.com>,
"luto@kernel.org" <luto@kernel.org>,
"peterz@infradead.org" <peterz@infradead.org>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"mingo@redhat.com" <mingo@redhat.com>,
"bp@alien8.de" <bp@alien8.de>, "hpa@zytor.com" <hpa@zytor.com>,
"x86@kernel.org" <x86@kernel.org>,
"YANGFENG1@kingsoft.com" <YANGFENG1@kingsoft.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
<yaoaili@kingsoft.com>
Subject: Re: [PATCH v2] x86/fault: Send a SIGBUS to user process always for hwpoison page access.
Date: Fri, 5 Feb 2021 13:06:16 +0800 [thread overview]
Message-ID: <20210205130616.6d876846@alex-virtual-machine> (raw)
In-Reply-To: <20210204072555.GA22850@hori.linux.bs1.fc.nec.co.jp>
On Thu, 4 Feb 2021 07:25:55 +0000
HORIGUCHI NAOYA(堀口 直也) <naoya.horiguchi@nec.com> wrote:
> Hi Aili,
>
> On Mon, Feb 01, 2021 at 04:17:49PM +0800, Aili Yao wrote:
> > When one page is already hwpoisoned by AO action, process may not be
> > killed, the process mapping this page may make a syscall include this
> > page and result to trigger a VM_FAULT_HWPOISON fault, if it's in kernel
> > mode it may be fixed by fixup_exception. Current code will just return
> > error code to user process.
> >
> > This is not sufficient, we should send a SIGBUS to the process and log
> > the info to console, as we can't trust the process will handle the error
> > correctly.
> >
> > Suggested-by: Feng Yang <yangfeng1@kingsoft.com>
> > Signed-off-by: Aili Yao <yaoaili@kingsoft.com>
> > ---
> ...
>
> > @@ -662,12 +662,32 @@ no_context(struct pt_regs *regs, unsigned long error_code,
> > * In this case we need to make sure we're not recursively
> > * faulting through the emulate_vsyscall() logic.
> > */
> > +
> > + if (IS_ENABLED(CONFIG_MEMORY_FAILURE) &&
> > + fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
> > + unsigned int lsb = 0;
> > +
> > + pr_err("MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",
> > + current->comm, current->pid, address);
> > +
> > + sanitize_error_code(address, &error_code);
> > + set_signal_archinfo(address, error_code);
> > +
> > + if (fault & VM_FAULT_HWPOISON_LARGE)
> > + lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault));
> > + if (fault & VM_FAULT_HWPOISON)
> > + lsb = PAGE_SHIFT;
> > +
> > + force_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, lsb);
>
> This part contains some duplicated code with do_sigbus(), so some refactoring (like
> adding a common function) would be more helpful.
Yes, agree, I will modify this and rebase to the big fault series from tip.
Thanks
Aili Yao
next prev parent reply other threads:[~2021-02-05 5:06 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 8:17 Aili Yao
2021-02-01 16:58 ` Andy Lutomirski
2021-02-01 21:10 ` Luck, Tony
2021-02-01 22:09 ` Andy Lutomirski
2021-02-02 6:42 ` Aili Yao
2021-02-04 7:25 ` HORIGUCHI NAOYA(堀口 直也)
2021-02-05 5:06 ` Aili Yao [this message]
2021-02-05 9:01 ` [PATCH v3] " Aili Yao
2021-02-23 12:44 ` Aili Yao
2021-02-23 15:33 ` Andy Lutomirski
2021-02-23 16:42 ` Luck, Tony
2021-02-25 4:47 ` Aili Yao
2021-02-27 3:40 ` Andy Lutomirski
2021-03-01 7:57 ` Aili Yao
2021-03-01 18:12 ` Luck, Tony
2021-03-01 19:02 ` Luck, Tony
2021-03-01 19:09 ` Andy Lutomirski
2021-03-03 12:24 ` Aili Yao
2021-03-03 12:51 ` Aili Yao
2021-03-07 19:16 ` Andy Lutomirski
2021-03-08 9:49 ` Aili Yao
2021-03-08 18:14 ` Andy Lutomirski
2021-03-08 18:31 ` Luck, Tony
2021-03-08 19:00 ` Andy Lutomirski
2021-03-11 1:19 ` Aili Yao
2021-03-11 1:28 ` Andy Lutomirski
2021-03-11 2:01 ` Aili Yao
2021-03-11 16:52 ` Luck, Tony
2021-03-11 16:56 ` Peter Zijlstra
2021-03-09 2:14 ` Aili Yao
2021-03-09 2:25 ` Aili Yao
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=20210205130616.6d876846@alex-virtual-machine \
--to=yaoaili@kingsoft.com \
--cc=YANGFENG1@kingsoft.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=naoya.horiguchi@nec.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/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