]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
KVM: x86: Emulator fixes for eip canonical checks on near branches
authorNadav Amit <namit@cs.technion.ac.il>
Thu, 18 Sep 2014 19:39:38 +0000 (22:39 +0300)
committerJiri Slaby <jslaby@suse.cz>
Thu, 13 Nov 2014 18:02:29 +0000 (19:02 +0100)
commita20e81cb2b2b8aebdca9d11b6fa2133f1b97251d
tree25b54edae7382bd2e92d3d3b16d7e0a6bd396c5f
parent4b4290c052b7180700de7257793a31f4c0ae75df
KVM: x86: Emulator fixes for eip canonical checks on near branches

commit 234f3ce485d54017f15cf5e0699cff4100121601 upstream.

Before changing rip (during jmp, call, ret, etc.) the target should be asserted
to be canonical one, as real CPUs do.  During sysret, both target rsp and rip
should be canonical. If any of these values is noncanonical, a #GP exception
should occur.  The exception to this rule are syscall and sysenter instructions
in which the assigned rip is checked during the assignment to the relevant
MSRs.

This patch fixes the emulator to behave as real CPUs do for near branches.
Far branches are handled by the next patch.

This fixes CVE-2014-3647.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
arch/x86/kvm/emulate.c