Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2302272imm; Thu, 20 Sep 2018 10:51:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYao3tKMCxdtuCsnw53twoI6q1qGuhb1cH3CVRnWBznmpyRk9g/uA0a/EuNWfTTzsaRt55E X-Received: by 2002:a17:902:8bc4:: with SMTP id r4-v6mr39247309plo.124.1537465873739; Thu, 20 Sep 2018 10:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537465873; cv=none; d=google.com; s=arc-20160816; b=MG38lBguTaYmJ8y6uCE0JRMEs9buKKYFQ8PTOpXTjHpTQgly8MnIeZsIyhGLdf/RxD U715IODeuaTA3TUR3JyOvLfC4osm5lq7JYllxI+d6ybl0nZTqRTH4hobzu17rGxjS4sN CcuE3bZCazNqZm2B+LHKSvfwLmaMBDP+oGxzVKQeue7cfBXPw5wnsOSBf9LRj8rX7/qy rKUJJoI9ekEpd1Z/XliIa2zSsxPq/ydqYvv6vAboZR2HIdtnNOzIL0sMkJGoNC7k+2Gh /17hM36RYAtjTUoXdhzLAbBS7PyrPiJf6NVIhl6swZu3A2Bw4uOXc7DLst8FbFJ9A+EX 7CUg== 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=Nv5CVR5indZVqAe0smq7s2VvPZFWg6pPFyrbZBVAnX0=; b=Y9bU70akgcAOR2jhZxAF57S76W1rKANdmilQuSz4ljhma3hjVlorFw9HQ+9LvWPdhm ZnRTiEAjSaEdmG19MMyXR+jFFd15ogos9TWu/owEAKVbQZPLxKe5qTFizMdVBjYTr0Yh GbPi6qZ9vMDWzA8tcy9jfUE+ToJtxVqRfg9u78GBT/cAs0fmg+l8UJFs/pqCV+Beof95 6OSgu0lFOmvKlsqZ4Pgwcs2IE8Dypff4OceITIjZm53ZBhkMPFsJiIAot1aI5UilVFZI tW1i0Kx/yCxEMphqr/QQ2hRIDmUwtBY8Sr9MYLmEdYXOVyjcsh27XZEgvlfbLM53x7bU 6zsQ== 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 q1-v6si26341271pfj.149.2018.09.20.10.50.56; Thu, 20 Sep 2018 10:51:13 -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 S1731223AbeITXf2 (ORCPT + 99 others); Thu, 20 Sep 2018 19:35:28 -0400 Received: from mga17.intel.com ([192.55.52.151]:44866 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726925AbeITXf1 (ORCPT ); Thu, 20 Sep 2018 19:35:27 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Sep 2018 10:50:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,281,1534834800"; d="scan'208";a="74643014" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.148]) by orsmga007.jf.intel.com with ESMTP; 20 Sep 2018 10:50:17 -0700 Date: Thu, 20 Sep 2018 10:50:17 -0700 From: Sean Christopherson To: Paolo Bonzini Cc: Yi Wang , rkrcmar@redhat.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, zhong.weidong@zte.com.cn, xu.xi8@zte.com.cn, peng.hao2@zte.com.cn, jiang.biao2@zte.com.cn Subject: Re: [PATCH] KVM: x86: fix failure of injecting exceptions in x86_emulate_instruction Message-ID: <20180920175017.GB10381@linux.intel.com> References: <1536220964-8412-1-git-send-email-wang.yi59@zte.com.cn> <9835d255-dd9a-222b-f4a2-93611175b326@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 +cc Peng Hao and Jiang Biao On Thu, Sep 20, 2018 at 06:53:55PM +0200, Paolo Bonzini wrote: > On 20/09/2018 18:30, Paolo Bonzini wrote: > > On 06/09/2018 10:02, Yi Wang wrote: > >> In order to fix a page table walk issue, commit 6ea6e84309ca > >> ("KVM: x86: inject exceptions produced by x86_decode_insn") check > >> if variable ctxt->have_exception true and inject the exception. > >> Unfortunately, ctxt->have_exception is set to true only in function > >> x86_emulate_insn(), which won't be called before invoking > >> inject_emulated_exception() in the 6ea6e84309ca. > >> This patch fix this issue. > >> > >> Signed-off-by: Yi Wang > >> Reviewed-by: Xi Xu > > > > Queued, thanks. Do you have a testcase for this? > > Unqueued, sorry. The hypercall test from kvm-unit-tests fails. A > VMCALL on the "edge" of canonical address space, i.e. at 0x7ffffffffffd, > raises a general protection fault before this patch and a double fault > afterwards. Peng Hao submitted a very similar patch[1], the difference being that it also modified x86_emulate_instruction() to ignore the result of inject_emulated_exception(). I have no idea if that change is correct but it may be related to the aforementioned unit test failing. [1] https://lkml.org/lkml/2018/9/19/38