Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751897AbdDNFKz (ORCPT ); Fri, 14 Apr 2017 01:10:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37272 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbdDNFKv (ORCPT ); Fri, 14 Apr 2017 01:10:51 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2485F4E4F5 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2485F4E4F5 Subject: Re: [PATCH] KVM: nVMX: fix AD condition when handling EPT violation To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , linux-kernel@vger.kernel.org, kvm@vger.kernel.org References: <20170413163918.5830-1-rkrcmar@redhat.com> From: Paolo Bonzini Message-ID: Date: Fri, 14 Apr 2017 13:10:47 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170413163918.5830-1-rkrcmar@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 14 Apr 2017 05:10:51 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1415 Lines: 41 On 14/04/2017 00:39, Radim Krčmář wrote: > I have introduced this bug when applying and simplifying Paolo's patch > as we agreed on the list. The original was "x &= ~y; if (z) x |= y;". > > Here is the story of a bad workflow: > > A maintainer was already testing with the intended change, but it was > applied only to a testing repo on a different machine. When the time > to push tested patches to kvm/next came, he realized that this change > was missing and quickly added it to the maintenance repo, didn't test > again (because the change is trivial, right), and pushed the world to > fire. > > Fixes: ae1e2d1082ae ("kvm: nVMX: support EPT accessed/dirty bits") > Signed-off-by: Radim Krčmář > --- > arch/x86/kvm/vmx.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index cfdb0d9389d1..837f6dd1ae9c 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -6221,7 +6221,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu) > * page table accesses are reads or writes. > */ > u64 eptp = nested_ept_get_cr3(vcpu); > - if (eptp & VMX_EPT_AD_ENABLE_BIT) > + if (!(eptp & VMX_EPT_AD_ENABLE_BIT)) > exit_qualification &= ~EPT_VIOLATION_ACC_WRITE; > } > > I have done this as well, so you're forgiven. :) More important: did kvm-unit-test catch the bug? Paolo