OSDN Git Service

KVM: nSVM: use svm->nested.save to load vmcb12 registers and avoid TOC/TOU races
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Wed, 3 Nov 2021 14:05:25 +0000 (10:05 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Dec 2021 09:24:40 +0000 (04:24 -0500)
commit355d0473b1a11d7cf526fbd43c3908224e08a909
tree2b8685a8223b553e86509189035e5e956ccff649
parentb7a3d8b6f433d293e9033b9d63651b6d17bf5654
KVM: nSVM: use svm->nested.save to load vmcb12 registers and avoid TOC/TOU races

Use the already checked svm->nested.save cached fields
(EFER, CR0, CR4, ...) instead of vmcb12's in
nested_vmcb02_prepare_save().
This prevents from creating TOC/TOU races, since the
guest could modify the vmcb12 fields.

This also avoids the need of force-setting EFER_SVME in
nested_vmcb02_prepare_save.

Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Message-Id: <20211103140527.752797-6-eesposit@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/nested.c