Re: [patch V163 27/51] x86/mm/pti: Populate user PGD

From: Thomas Gleixner
Date: Wed Dec 20 2017 - 14:50:33 EST


On Wed, 20 Dec 2017, Juergen Gross wrote:
> On 20/12/17 01:22, Thomas Gleixner wrote:
> > On Tue, 19 Dec 2017, Thomas Gleixner wrote:
> >> On Tue, 19 Dec 2017, Ingo Molnar wrote:
> >> We don't run out of space, but the 0-day robot triggered a nasty issue.
> >>
> >> The fixmap bottom address, which contains the early_ioremap fixmap area, is:
> >>
> >> vaddr_bt = FIXADDR_TOP - FIX_BTMAP_BEGIN * PAGE_SIZE
> >>
> >> If that address is lower than:
> >>
> >> vaddr_end = __START_KERNEL_map + KERNEL_IMAGE_SIZE;
> >>
> >> then cleanup_highmap() will happily 0 out the PMD entry for the PTE page of
> >> FIX_BTMAP. That entry was set up earlier in early_ioremap_init().
> >>
> >> As a consequence the first call to __early_set_fixmap() which tries to
> >> install a PTE for early_ioremap() will crash and burn.
> >>
> >> Below is a nasty hack which fixes the problem. Ideally we get all of this
> >> cpu_entry_stuff out of the fixmap. I'll look into that later, but for now
> >> the patch 'fixes' the issue.
> >
> > I had a stab on moving the cpu_entry_area to some other place.
> >
> > The patch below works, but:
> >
> > - it breaks i386 build because I have not yet found a way to place the
> > CPU_ENTRY_AREA_BASE without creating include recursion hell
> >
> > - it probably does not work on XEN_PV, but I'm too tired now to figure
> > that out.
>
> The attached patch lets the system come up as XEN_PV.

I folded it back to the proper place.

Thanks for looking!

tglx