]> xenbits.xensource.com Git - xen.git/commit
x86/hvm: Correctly identify implicit supervisor accesses
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 24 Jun 2016 17:23:52 +0000 (18:23 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 9 Mar 2017 17:01:05 +0000 (17:01 +0000)
commitc5583614672d941661c986446e53af6e36d2bd32
treeb903e7b137d81b1a155a31e74ba2f850197c8ac6
parent5d99933e6e3e54da3c7291a0f4bf6c89685b4d24
x86/hvm: Correctly identify implicit supervisor accesses

All actions which refer to the active ldt/gdt/idt or task register
(e.g. loading a new segment selector) are known as implicit supervisor
accesses, even when the access originates from user code.

Right away, this fixes a bug during userspace emulation where a pagewalk for a
system table was (incorrectly) performed as a user access, causing an access
violation in the common case, as system tables reside on supervisor mappings.

The implicit/explicit distinction is necessary in the pagewalk when SMAP is
enabled.  Refer to Intel SDM Vol 3 "Access Rights" for the exact details.

Introduce a new pagewalk input, and make use of the new system segment
references in hvmemul_{read,write}().  While modifying those areas, move the
calculation of the appropriate pagewalk input before its first use.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Acked-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xen/arch/x86/hvm/emulate.c
xen/arch/x86/mm/guest_walk.c
xen/include/asm-x86/processor.h