Re: [PATCH] mm/memory-failure: fix race with compound page split/merge
From: Andrew Morton
Date: Thu Apr 21 2016 - 19:44:59 EST
On Mon, 18 Apr 2016 23:15:52 +0000 Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> wrote:
> # CCed Andrew,
Thanks.
> On Mon, Apr 18, 2016 at 02:43:45PM +0300, Konstantin Khlebnikov wrote:
> > Get_hwpoison_page() must recheck relation between head and tail pages.
> >
> > Signed-off-by: Konstantin Khlebnikov <khlebnikov@xxxxxxxxxxxxxx>
>
> Looks good to me. Without this recheck, the race causes kernel to pin
> an irrelevant page, and finally makes kernel crash for refcount mismcach...
Thanks. I'll add the above (important!) info to the changelog and
cc:stable.
> > - return get_page_unless_zero(head);
> > + if (get_page_unless_zero(head)) {
> > + if (head == compound_head(page))
> > + return 1;
> > +
> > + pr_info("MCE: %#lx cannot catch tail\n", page_to_pfn(page));
>
> Recently Chen Yucong replaced the label "MCE:" with "Memory failure:",
> but the resolution is trivial, I think.
Yup, that patch is in my (large) backlog. Away at conferences for
seven days, receiving 100 actionable emails per day. Give me a few
days ;)