]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: fix emulation of "MOV SS, null selector"
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 12 Jan 2017 14:02:32 +0000 (15:02 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 12 Jan 2017 14:17:13 +0000 (15:17 +0100)
commit5d2c9eff81020cdc02464ee2ef1b014226ac3da5
tree61bb5323aea25c0f3dd96d8a9891106898d28cad
parentdd006fcdb4346a130f36a1f09e703af72d7c735b
KVM: x86: fix emulation of "MOV SS, null selector"

This is CVE-2017-2583.  On Intel this causes a failed vmentry because
SS's type is neither 3 nor 7 (even though the manual says this check is
only done for usable SS, and the dmesg splat says that SS is unusable!).
On AMD it's worse: svm.c is confused and sets CPL to 0 in the vmcb.

The fix fabricates a data segment descriptor when SS is set to a null
selector, so that CPL and SS.DPL are set correctly in the VMCS/vmcb.
Furthermore, only allow setting SS to a NULL selector if SS.RPL < 3;
this in turn ensures CPL < 3 because RPL must be equal to CPL.

Thanks to Andy Lutomirski and Willy Tarreau for help in analyzing
the bug and deciphering the manuals.

Reported-by: Xiaohan Zhang <zhangxiaohan1@huawei.com>
Fixes: 6bfe8451771489e76f29bb1a267ef8051263766f
Cc: stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/emulate.c