[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <97a2511e-2002-ec25-6902-8fe841922138@redhat.com>
Date: Wed, 24 Feb 2021 11:10:23 +0100
From: David Hildenbrand <david@...hat.com>
To: Aili Yao <yaoaili@...gsoft.com>, naoya.horiguchi@....com,
akpm@...ux-foundation.org, tony.luck@...el.com, bp@...en8.de,
tglx@...utronix.de, mingo@...hat.com, hpa@...or.com
Cc: x86@...nel.org, inux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
yangfeng1@...gsoft.com
Subject: Re: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned
On 24.02.21 08:16, Aili Yao wrote:
> When the page is already poisoned, another memory_failure() call in the
> same page now return 0, meaning OK. For nested memory mce handling, this
> behavior may lead real serious problem, Example:
>
> 1.When LCME is enabled, and there are two processes A && B running on
> different core X && Y separately, which will access one same page, then
> the page corrupted when process A access it, a MCE will be rasied to
> core X and the error process is just underway.
>
> 2.Then B access the page and trigger another MCE to core Y, it will also
> do error process, it will see TestSetPageHWPoison be true, and 0 is
> returned.
>
> 3.The kill_me_maybe will check the return:
>
> 1244 static void kill_me_maybe(struct callback_head *cb)
> 1245 {
>
> 1254 if (!memory_failure(p->mce_addr >> PAGE_SHIFT, flags) &&
> 1255 !(p->mce_kflags & MCE_IN_KERNEL_COPYIN)) {
> 1256 set_mce_nospec(p->mce_addr >> PAGE_SHIFT,
> p->mce_whole_page);
> 1257 sync_core();
> 1258 return;
> 1259 }
>
> 1267 }
>
> 4. The error process for B will end, and may nothing happened if
> kill-early is not set, We may let the wrong data go into effect.
>
> For other cases which care the return value of memory_failure() should
> check why they want to process a memory error which have already been
> processed. This behavior seems reasonable.
>
> In kill_me_maybe, log the fact about the memory may not recovered, and
> we will kill the related process.
>
Is -EBUSY then the right return value?
I'd expect if it's already poisoned that we would get something like
EHWPOISON.
Does this affect existing user space interfaces (especially, via madvise?)?
--
Thanks,
David / dhildenb
Powered by blists - more mailing lists