]> git.ipfire.org Git - people/ms/linux.git/commit
KVM: x86: use new CS.RPL as CPL during task switch
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 15 May 2014 15:56:57 +0000 (17:56 +0200)
committerZefan Li <lizefan@huawei.com>
Mon, 2 Feb 2015 09:04:58 +0000 (17:04 +0800)
commitd1d7b57b3c62a47e0a2a2a4c742d7df06b58cd15
tree1d70c7d0284651038a0ad5c77ecb35a2508b0470
parent858f9338565cba5fba27a30466417816f7ed5035
KVM: x86: use new CS.RPL as CPL during task switch

commit 2356aaeb2f58f491679dc0c38bc3f6dbe54e7ded upstream.

During task switch, all of CS.DPL, CS.RPL, SS.DPL must match (in addition
to all the other requirements) and will be the new CPL.  So far this
worked by carefully setting the CS selector and flag before doing the
task switch; setting CS.selector will already change the CPL.

However, this will not work once we get the CPL from SS.DPL, because
then you will have to set the full segment descriptor cache to change
the CPL.  ctxt->ops->cpl(ctxt) will then return the old CPL during the
task switch, and the check that SS.DPL == CPL will fail.

Temporarily assume that the CPL comes from CS.RPL during task switch
to a protected-mode task.  This is the same approach used in QEMU's
emulation code, which (until version 2.0) manually tracks the CPL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[lizf: Backported to 3.4: adjust context]
Signed-off-by: Zefan Li <lizefan@huawei.com>
arch/x86/kvm/emulate.c