lkml.org 
[lkml]   [2021]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH] mm,hwpoison: return -EBUSY when page already poisoned
    From
    Date
    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

    \
     
     \ /
      Last update: 2021-02-24 11:15    [W:3.970 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site