From: Paolo Bonzini Subject: Re: [PATCH] kvm: x86: Disallow illegal IA32_APIC_BASE MSR values Date: Thu, 10 Aug 2017 11:37:56 +0200 Message-ID: References: <20170808232726.118570-1-jmattson@google.com> <14bc7c98-d4a8-7e97-3da2-b5792a4b3e22@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: kvm list To: David Hildenbrand , Jim Mattson Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42912 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751731AbdHJJiB (ORCPT ); Thu, 10 Aug 2017 05:38:01 -0400 In-Reply-To: Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 09/08/2017 22:31, David Hildenbrand wrote: > On 09.08.2017 17:14, Jim Mattson wrote: >> The only thing that makes me unhappy about this is that the >> KVM_SET_SREGS ioctl may modify some VCPU state before returning >> -EINVAL. I could hoist the call to kvm_set_apic_base, but that only >> works for one mutator. If this doesn't bother anyone else, I'll just >> leave it where it is. > > Good point, but the question is if the caller is even able to recover > from this failure? Likely not, but being cleaner is usually better... > If we care, you might have to move kvm_set_apic_base() to the very top > in kvm_arch_vcpu_ioctl_set_sregs. Or just do the check at that point. > > Guess Paolo knows the answer to our question, just as always :) Not sure I do, but I am (though only slightly) worried about not doing the kvm_mmu_reset_context if EFER as changed and also about missing update_cr8_intercept. Moving kvm_set_apic_base early is harmless, so why not move that to the beginning. Paolo