Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp34591ybl; Thu, 29 Aug 2019 18:07:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqx/qpWWltr0Jyeb8Rnovlq+gvFEkzzaibmNSFLpZTjYLT1tgufuhr0GNbagOmJm5LJGSKkz X-Received: by 2002:a65:6709:: with SMTP id u9mr10853296pgf.58.1567127243233; Thu, 29 Aug 2019 18:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567127243; cv=none; d=google.com; s=arc-20160816; b=CWorinh7yqhBzryTqskj/l8FjJ9WVQdqLHhArZIzDgBPTYFZ/ZeFtdPsMT7aMQ6QTP +ybN7JoH2NC6lH4OA38S8A0T4jLRgo09cFG6LBZq3CM+QSbM3UYLQ/LmLHDKujQmxqii 7CETRJBaIHQxzInPlLpvAkrBOwwh40pOgX54C9W0rCohG5LKpAShpI5GZubDm180V853 TGaPj80PF6OQuB322oXiVzS+SGxoJgeMrUbG8wimqR0jQ6aZ8W8cbHtK/Y2Y8SdGiM7Z Gji05862bL0caqZDQk1tdqdwlzdB1IiJfHhK0/uJ+7uwEOktsBc2TnKVVV575yXCnx3g UbbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=74AvxnRQejBjf4eu09dAxtYIvkOiYolAVyTwzGSXerw=; b=uDqJNjiev4sCGtB+gkRbwp4DzZjp9sEOJWi8+n2k53sODqunhV478UNmRd9wRk8y8z HRD64jssZ7FtpgUqLLUApyV+1FFNCj3cByNOFVTOs1pLRdcDhsKamXql8TK+ITQ9h9uw AV/c2i7xbaJaFc+FRbAaPANWYEFwlyJWGWGZqj7BErX0o+tyCq24LQLdM2+rXwhE75ZC 2VvmAR3fg4CiIkQrWdu3zOQvOVHehCp6qhfNdE8mkqGmxnDT9wrEo0qGKLEmpqBrV1d3 mZu0C7aa7HVJYRFkg7C+YXHUx2Y80dtT58fKhprAic37zSGKTqQEbgxLjb+XcXht4Kqo dfIA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v14si3608401pjb.82.2019.08.29.18.07.06; Thu, 29 Aug 2019 18:07:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727386AbfH3BGR (ORCPT + 99 others); Thu, 29 Aug 2019 21:06:17 -0400 Received: from mga03.intel.com ([134.134.136.65]:39895 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726825AbfH3BGR (ORCPT ); Thu, 29 Aug 2019 21:06:17 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Aug 2019 18:06:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,445,1559545200"; d="scan'208";a="381844739" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.41]) by fmsmga006.fm.intel.com with ESMTP; 29 Aug 2019 18:06:15 -0700 Date: Thu, 29 Aug 2019 18:06:15 -0700 From: Sean Christopherson To: Jan Dakinevich Cc: "linux-kernel@vger.kernel.org" , Denis Lunev , Roman Kagan , Denis Plotnikov , Paolo Bonzini , Radim =?utf-8?B?S3LEjW3DocWZ?= , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , "x86@kernel.org" , "kvm@vger.kernel.org" Subject: Re: [PATCH v3 1/2] KVM: x86: always stop emulation on page fault Message-ID: <20190830010615.GC27970@linux.intel.com> References: <1567066988-23376-1-git-send-email-jan.dakinevich@virtuozzo.com> <1567066988-23376-2-git-send-email-jan.dakinevich@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1567066988-23376-2-git-send-email-jan.dakinevich@virtuozzo.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 29, 2019 at 08:23:18AM +0000, Jan Dakinevich wrote: > inject_emulated_exception() returns true if and only if nested page > fault happens. However, page fault can come from guest page tables > walk, either nested or not nested. In both cases we should stop an > attempt to read under RIP and give guest to step over its own page > fault handler. > > Fixes: 6ea6e84 ("KVM: x86: inject exceptions produced by x86_decode_insn") Commit ids should be at least 12 chars, the full tag should be Fixes: 6ea6e84309ca ("KVM: x86: inject exceptions produced by x86_decode_insn") You can force this in your git config, e.g. git config --global core.abbrev 12 Both patches in this series should probably have Cc: Reviewed-and-tested-by: Sean Christopherson > Cc: Denis Lunev > Cc: Roman Kagan > Cc: Denis Plotnikov > Signed-off-by: Jan Dakinevich > --- > arch/x86/kvm/x86.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index b4cfd78..6bf7b55 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -6537,8 +6537,13 @@ int x86_emulate_instruction(struct kvm_vcpu *vcpu, > if (reexecute_instruction(vcpu, cr2, write_fault_to_spt, > emulation_type)) > return EMULATE_DONE; > - if (ctxt->have_exception && inject_emulated_exception(vcpu)) > + if (ctxt->have_exception) { > + WARN_ON_ONCE(ctxt->exception.vector == UD_VECTOR); > + WARN_ON_ONCE(exception_type(ctxt->exception.vector) > + == EXCPT_TRAP); > + inject_emulated_exception(vcpu); > return EMULATE_DONE; > + } > if (emulation_type & EMULTYPE_SKIP) > return EMULATE_FAIL; > return handle_emulation_failure(vcpu, emulation_type); > -- > 2.1.4 >