Re: Q:pt_base in COMPAT mode offset by two pages. Was:Re:[Xen-devel] [PATCH 02/11] xen/x86: Use memblock_reserve for sensitive areas.

From: Konrad Rzeszutek Wilk
Date: Wed Aug 22 2012 - 10:10:45 EST


> > + /* Under 64-bit hypervisor with a 32-bit domain, the hypervisor
> > + * offsets the pt_base by two pages. Hence the reservation that is done
> > + * in mmu.c misses two pages. We correct it here if we detect this. */
> > + if (last_phys < __pa(xen_start_info->pt_base))
> > + memblock_reserve(last_phys, __pa(xen_start_info->pt_base) - last_phys);
> > }
>
> What are these two pages used for? They are not documented in xen.h, why
> should we reserve them?
>
> After all we still have:
>
> memblock_reserve(PFN_PHYS(pt_base), (pt_end - pt_base) * PAGE_SIZE);
>
> that should protect what we are interested in anyway...

You are looking at the x86_64 piece of code. This issue only appears
on 32-bit which was not modified by my patches and has:

2003 memblock_reserve(__pa(xen_start_info->pt_base),
2004 xen_start_info->nr_pt_frames * PAGE_SIZE);

and as I found out, the pt_base is wrong. The cr3 we load and use is actually
two pages back!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/