Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp499481pxu; Fri, 23 Oct 2020 06:32:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjwS33BqITwcx2hk8O2xr/sVFqSQ3eub5KklmTOUzsibz8ZI0VNfZsgxrqodNXxTPrVQq/ X-Received: by 2002:a17:906:c109:: with SMTP id do9mr1928213ejc.142.1603459960169; Fri, 23 Oct 2020 06:32:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603459960; cv=none; d=google.com; s=arc-20160816; b=JLsDMFuYkDiyaYJ+JWjn0XRkd9n3McDdyZlVgzqj5tIt0Q6HQ99uxjQesIdIEz09fT KbcX3vyQeyjauCca/SRT+A57oxs4M1PjoHfkvEVHUUa1CIo4de5jjA3PGpifX3EzwTQG bEmnOAfSZlL4MubMLbBYBEpRynZPiJ3pxHEIIdkoM1Nl8szx9UT3K8KnHR3PsuwjB+X8 Ud6dhKuHuerSC9pspMVPrUoe8vL3CAGmogAuOOGdJ6QD1303YCpbXpWEIm3rGgve+SXu 4QHdbrbt4FmEJ2l1nSqgpZLmxSQFZdfzxW3aSNN/J9MD1qQZOY+ocfZULV4jOohgbEro o+Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=cjJd9azqkmQJuFEms8Af/Wg/iqZShSkBcNqXr34XGg8=; b=rGs1yeP8lQfFKq/Y6NQWswrerDiMsu36H4f58b1Sq13AP3+/NuVQbWqy66hm0dL/V9 ZrsU/vdOPCGo1qpg4yk2yMECkcsBLlnX0z3RZW18g0p8TMGxjv2EqE1h+v7vXdiqZnnI BhHwdHfNZXwy0Zbb5wJJhn0hUPAhwIKLSXhb7i6twh/Itg2kpvmtS9Rw6isa1rbPY615 T6Wl21xLjtHaCkJrfPy7tRNcYJdyK5VelBkKut0W9SfISETwqBktSlDGV5FBIOfYzJC3 /9HPkFMhC0gnpDw/2XAWSkRIH3lk+07iC1g872SdMl063C5/XDz/n+ybHCOvqjGQqhB6 XKfw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id lx14si806503ejb.115.2020.10.23.06.32.17; Fri, 23 Oct 2020 06:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S460309AbgJWDOf (ORCPT + 99 others); Thu, 22 Oct 2020 23:14:35 -0400 Received: from mga02.intel.com ([134.134.136.20]:51179 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460302AbgJWDOf (ORCPT ); Thu, 22 Oct 2020 23:14:35 -0400 IronPort-SDR: EFAI8MCFg+t12VBxkwHO32IQyiNnshOvbdHAVw3YiYThD4ozuGMIYp4BmqFm2ZtVXfzRgH5Qhy 57CAHeo44Wnw== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="154580356" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="154580356" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 20:14:34 -0700 IronPort-SDR: p6CNCd4eagDKxkiyiJUCnAaQSYO7wabCEomHDn0v6o2bn2PGWZ1H+d3+sl7Ry+WMHRhglaIf66 +BgrA/HDlJYg== X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="316944216" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.160]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 20:14:34 -0700 Date: Thu, 22 Oct 2020 20:14:33 -0700 From: Sean Christopherson To: Jim Mattson Cc: Mohammed Gamal , kvm list , Paolo Bonzini , LKML , Vitaly Kuznetsov , Wanpeng Li , Joerg Roedel Subject: Re: [PATCH v3 7/9] KVM: VMX: Add guest physical address check in EPT violation and misconfig Message-ID: <20201023031433.GF23681@linux.intel.com> References: <20200710154811.418214-1-mgamal@redhat.com> <20200710154811.418214-8-mgamal@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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 14, 2020 at 04:44:57PM -0700, Jim Mattson wrote: > On Fri, Oct 9, 2020 at 9:17 AM Jim Mattson wrote: > > > > On Fri, Jul 10, 2020 at 8:48 AM Mohammed Gamal wrote: > > > @@ -5308,6 +5314,18 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu) > > > PFERR_GUEST_FINAL_MASK : PFERR_GUEST_PAGE_MASK; > > > > > > vcpu->arch.exit_qualification = exit_qualification; > > > + > > > + /* > > > + * Check that the GPA doesn't exceed physical memory limits, as that is > > > + * a guest page fault. We have to emulate the instruction here, because > > > + * if the illegal address is that of a paging structure, then > > > + * EPT_VIOLATION_ACC_WRITE bit is set. Alternatively, if supported we > > > + * would also use advanced VM-exit information for EPT violations to > > > + * reconstruct the page fault error code. > > > + */ > > > + if (unlikely(kvm_mmu_is_illegal_gpa(vcpu, gpa))) > > > + return kvm_emulate_instruction(vcpu, 0); > > > + > > > > Is kvm's in-kernel emulator up to the task? What if the instruction in > > question is AVX-512, or one of the myriad instructions that the > > in-kernel emulator can't handle? Ice Lake must support the advanced > > VM-exit information for EPT violations, so that would seem like a > > better choice. > > > Anyone? Using "advanced info" if it's supported seems like the way to go. Outright requiring it is probably overkill; if userspace wants to risk having to kill a (likely broken) guest, so be it.