From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933933AbdKBRfu (ORCPT ); Thu, 2 Nov 2017 13:35:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54850 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932241AbdKBRft (ORCPT ); Thu, 2 Nov 2017 13:35:49 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EA0C7C0587E4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=pbonzini@redhat.com Subject: Re: [PATCH v2] KVM: X86: #GP when guest attempts to write MCi_STATUS register w/o 0 To: Jim Mattson , Wanpeng Li Cc: LKML , kvm list , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li References: <1508420876-3780-1-git-send-email-wanpeng.li@hotmail.com> From: Paolo Bonzini Message-ID: <6e8a071e-0d5a-45d2-b2ef-4f6172ef4cff@redhat.com> Date: Thu, 2 Nov 2017 18:35:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 02 Nov 2017 17:35:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/10/2017 20:09, Jim Mattson wrote: > "(offset & 0x3) == 1" seems like an obfuscated way of writing the > predicate, is_mci_status_msr(msr). But other than that, this change > looks fine to me. > > I'm a little more concerned about the code above. At the very least, > it needs to let the host set an arbitrary value for save/restore to > work. Why? The guest cannot have written anything but the three allowed values, userspace cannot write anything else either outside save/restore without KVM_SET_MSR failing, and KVM itself (specifically kvm_vcpu_ioctl_x86_setup_mce) only ever initializes IA32_MCi_CTL to all ones. So save will only ever find those three values, and restore's KVM_SET_MSR restore should never fail either. Thanks, Paolo > Reviewed-by: Jim Mattson