]> xenbits.xensource.com Git - people/iwj/xen.git/commit
x86/pagewalk: Re-implement the pagetable walker
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 Jun 2016 19:52:57 +0000 (20:52 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 27 Mar 2017 10:49:25 +0000 (11:49 +0100)
commit4c5d78a10dc89427140a50a1df5a0b8e9f073e82
tree372219cfc5e20c174f77d1da683a22bbc41a03dd
parent16f2ad1fe96373c8e656365738bdae1598c40006
x86/pagewalk: Re-implement the pagetable walker

The existing pagetable walker has complicated return semantics, which squeeze
multiple pieces of information into single integer.  This would be fine if the
information didn't overlap, but it does.

Specifically, _PAGE_INVALID_BITS for 3-level guests alias _PAGE_PAGED and
_PAGE_SHARED.  A guest which constructs a PTE with bits 52 or 53 set (the
start of the upper software-available range) will create a virtual address
which, when walked by Xen, tricks Xen into believing the frame is paged or
shared.  This behaviour was introduced by XSA-173 (c/s 8b17648).

It is also complicated to turn rc back into a normal pagefault error code.
Instead, change the calling semantics to return a boolean indicating success,
and have the function accumulate a real pagefault error code as it goes
(including synthetic error codes, which do not alias hardware ones).  This
requires an equivalent adjustment to map_domain_gfn().

Issues fixed:
 * 2-level PSE36 superpages now return the correct translation.
 * 2-level L2 superpages without CR0.PSE now return the correct translation.
 * SMEP now inhibits a user instruction fetch even if NX isn't active.
 * Supervisor writes without CR0.WP now set the leaf dirty bit.
 * L4e._PAGE_GLOBAL is strictly reserved on AMD.
 * 3-level l3 entries have all reserved bits checked.
 * 3-level entries can no longer alias Xen's idea of paged or shared.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/mm/guest_walk.c
xen/arch/x86/mm/hap/guest_walk.c
xen/arch/x86/mm/hap/nested_ept.c
xen/arch/x86/mm/p2m.c
xen/arch/x86/mm/shadow/multi.c
xen/include/asm-x86/guest_pt.h
xen/include/asm-x86/p2m.h
xen/include/asm-x86/page.h
xen/include/asm-x86/processor.h
xen/include/asm-x86/x86_64/page.h