]> git.itanic.dy.fi Git - linux-stable/commit
kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 6 Jun 2018 15:38:09 +0000 (17:38 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 25 Sep 2018 22:47:24 +0000 (23:47 +0100)
commitc1eef5daecfd48a4e85a0b4f37239b8dbfb9703a
tree4a4c0a78bf3ae1f29207c048dfa67e8437e31ddd
parentb1632afd23734e0d565ace124df0bc9c55a7575e
kvm: x86: use correct privilege level for sgdt/sidt/fxsave/fxrstor access

commit 3c9fa24ca7c9c47605672916491f79e8ccacb9e6 upstream.

The functions that were used in the emulation of fxrstor, fxsave, sgdt and
sidt were originally meant for task switching, and as such they did not
check privilege levels.  This is very bad when the same functions are used
in the emulation of unprivileged instructions.  This is CVE-2018-10853.

The obvious fix is to add a new argument to ops->read_std and ops->write_std,
which decides whether the access is a "system" access or should use the
processor's CPL.

Fixes: 129a72a0d3c8 ("KVM: x86: Introduce segmented_write_std", 2017-01-12)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[bwh: Backported to 3.16: Drop change in handle_ud()]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/x86/include/asm/kvm_emulate.h
arch/x86/kvm/emulate.c
arch/x86/kvm/x86.c