Re: [PATCH] mm/page_alloc: fix a crash in free_pages_prepare()

From: Heiko Carstens
Date: Mon Sep 30 2019 - 03:44:48 EST


On Fri, Sep 27, 2019 at 05:15:08PM -0400, Qian Cai wrote:
> On Fri, 2019-09-27 at 13:48 -0700, Andrew Morton wrote:
> > On Fri, 27 Sep 2019 15:47:03 -0400 Qian Cai <cai@xxxxxx> wrote:
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -1175,11 +1175,11 @@ static __always_inline bool free_pages_prepare(struct page *page,
> > > debug_check_no_obj_freed(page_address(page),
> > > PAGE_SIZE << order);
> > > }
> > > - arch_free_page(page, order);
> > > if (want_init_on_free())
> > > kernel_init_free_pages(page, 1 << order);
> > >
> > > kernel_poison_pages(page, 1 << order, 0);
> > > + arch_free_page(page, order);
> > > if (debug_pagealloc_enabled())
> > > kernel_map_pages(page, 1 << order, 0);
> >
> > This is all fairly mature code, isn't it? What happened to make this
> > problem pop up now?
>
> In the past, there is only kernel_poison_pages() would trigger it but it needs
> "page_poison=on" kernel cmdline, and I suspect nobody tested that on s390 in the
> past.

Yes. Peter Oberparleiter reported this also before my short vacation,
but I didn't have time to look into this. Thanks for fixing!

Reviewed-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>