BACKPORT: KVM: nVMX: add missing consistency checks for CR0 and CR4

The effective values of the guest CR0 and CR4 registers may differ from
those included in the VMCS12.  In particular, disabling EPT forces
CR4.PAE=1 and disabling unrestricted guest mode forces CR0.PG=CR0.PE=1.

Therefore, checks on these bits cannot be delegated to the processor
and must be performed by KVM.

Reported-by: Reima ISHII <ishiir@g.ecc.u-tokyo.ac.jp>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 112e66017bff7f2837030f34c2bc19501e9212d5)

Backport taken from v5.4.y stable release.

BUG=b:278162092
TEST=CQ

Signed-off-by: Guenter Roeck <groeck@chromium.org>

Change-Id: Ieebcae5676fecb6ac0c14bea16ec305ac79996f9
Disallow-Recycled-Builds: test-failures
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/4425644
Auto-Submit: Guenter Roeck <groeck@chromium.org>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Zubin Mithra <zsm@chromium.org>
Commit-Queue: Zubin Mithra <zsm@chromium.org>
1 file changed