[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210809145343.97685-1-eesposit@redhat.com>
Date: Mon, 9 Aug 2021 16:53:41 +0200
From: Emanuele Giuseppe Esposito <eesposit@...hat.com>
To: kvm@...r.kernel.org
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Maxim Levitsky <mlevitsk@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
Emanuele Giuseppe Esposito <eesposit@...hat.com>
Subject: [PATCH 0/2] KVM: nSVM: avoid TOC/TOU race when checking vmcb12
Currently there is a TOC/TOU race between the first check of vmcb12's
efer, cr0 and cr4 registers and the later save of their values in
svm_set_*, because the guest could modify the values in the meanwhile.
To solve this issue, this serie 1) moves the actual check nearer to the
usage (from nested_svm_vmrun to enter_svm_guest_mode), possible thanks
to the patch "KVM: nSVM: remove useless kvm_clear_*_queue"
and 2) adds local variables in enter_svm_guest_mode to save the
current value of efer, cr0 and cr4 and later use these to set the
vcpu->arch.* state.
Patch 1 just refactors the code to simplify the second patch, where
we move the TOC nearer to the TOU and use local variables.
Based-on: <20210802125634.309874-1-pbonzini@...hat.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@...hat.com>
Emanuele Giuseppe Esposito (2):
KVM: nSVM: move nested_vmcb_check_cr3_cr4 logic in
nested_vmcb_valid_sregs
KVM: nSVM: temporarly save vmcb12's efer, cr0 and cr4 to avoid TOC/TOU
races
arch/x86/kvm/svm/nested.c | 99 ++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 54 deletions(-)
--
2.31.1
Powered by blists - more mailing lists