]> www.infradead.org Git - users/jedix/linux-maple.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)
committerDhaval Giani <dhaval.giani@oracle.com>
Mon, 29 May 2017 20:49:06 +0000 (16:49 -0400)
commit74234706a6513943bfa97bf716b548197b494acf
treefe7cae75d93c96237d149f87456ae1686939bff8
parenta261ad64d409fcc06a2fed1a43d937fbb843c7f9
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.

Orabug: 25802278
CVE: CVE-2017-2583

Reported-by: Xiaohan Zhang <zhangxiaohan1@huawei.com>
Fixes: 79d5b4c3cd809c770d4bf9812635647016c56011
Cc: stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 33ab91103b3415e12457e3104f0e4517ce12d0f3)

Signed-off-by: Aniket Alshi <aniket.alshi@oracle.com>
Reviewed-by: Jack Vogel <jack.vogel@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
arch/x86/kvm/emulate.c