From patchwork Fri Feb 9 22:16:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 199135 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1163086dyd; Fri, 9 Feb 2024 14:20:09 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUTULpcV1uATu5peCCrULPN8gjQz0YLviaVh6Qib1Ecg9s4R8oDp9EbCQhR9nrDb9B05voc5Hz20jbP3oBqsSMstMJu5w== X-Google-Smtp-Source: AGHT+IGmPxh+3zMFZA0qBe/12QqW+Rj0ciE2X6GXDW6ZR2JxrRi+ShzQPAs7rbos2OO9jGDfWl7C X-Received: by 2002:a17:906:7f8a:b0:a38:4879:72f9 with SMTP id f10-20020a1709067f8a00b00a38487972f9mr301430ejr.24.1707517209094; Fri, 09 Feb 2024 14:20:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707517209; cv=pass; d=google.com; s=arc-20160816; b=AkPax5+V5djhTU1949o9BeqPOrgC0yGHGUhsLqfmAPXGclPm8NPriaC56R7+cy+8YP pMxZ95mUtZETrk2r2a9EAz11rMKNKEz9Qt6r88XUSfoNbWDxLSNArH048AFiuXgiDKW7 qsBITnxoP0sc7o2S0ulbhmRsbV5sGP2d5spNOvGff20yBZBAzt+tBPJSUbKxZnqxDgK4 mC0hPbbHnbAJw1njD6/V3fRy498LYzpVuTf28sza6Qq6xmwwCwlE8b1aGdAmP2XhehDj d8NrjXpJcYDpiQe/hwcMrVVWO9dfK5/i4xwJBsyOVubDXdmLV4CTN6+WW8lsiEZslO0A qbrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=EtUmW5C5jIEQG3Xq+wKcQPGgTDr9KsPcRaFSmsaaMus=; fh=d9ia8EFOIbU3KPYYePnWpWzo2m88Fzcbw/QiMHOapLs=; b=Uz90NirIYj78JHk8RTVIp5XWVdB4jQwBrFT+/sSkUaAZPcG+g/ND5SymBZ0vTdNQ4X xMj6cOsjH5cw5k5lcygGiN8eC+otI0V1SCAV3cVFbOEICwdLs8wPR6z7MNypOCGhuBIg OYN+zy0altNGU3Aja4m/o6KQ0+gf0d3SywkmpqXQA3pg90qIrOvI2l4palvN2PjGVUCh FNfx++6zSKkmkEikuz3G49ZO5fvF4QyARdXhhEkNGxepgKWGmwWYPJDOcYMrHXuVj00b iK34/AzvxStmEMpPZemGlXB7V9nFcEC4RGBEAqhaUylvgi6m8Lh771HuBnjZETuHahgZ kcWg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UVTnGWNa; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-60088-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60088-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCUkbGtg91odsY8yuy9Pe1khADwdcziarHAAB/zlfE5O1PIBYqYRloue8XYPeo1aebjtoUHdOHl58WLkX4FtO7d/Tq/ufw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y15-20020a170906470f00b00a3496faabbcsi1232217ejq.544.2024.02.09.14.20.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 14:20:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60088-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=UVTnGWNa; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-60088-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60088-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B4BDB1F24B91 for ; Fri, 9 Feb 2024 22:20:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5519E3C493; Fri, 9 Feb 2024 22:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="UVTnGWNa" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E43553984A for ; Fri, 9 Feb 2024 22:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517027; cv=none; b=EzQERn/Gmlui2ZUJRp/lE8SaOiyVi3WQ4Vurw0xOdba0amwQlzFGGYgbFAr2VsuClJd/zjX2+KpD/w7CrAbEFmllq6rSpK3eXrwMP6uYNzuio4FV4wn/sRUTfxp1fcR0XvJt1wxPWfnJ/S/V0zBqVfk+xEkU2YfbvS21PoqXmkM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517027; c=relaxed/simple; bh=vCfMinZ3ioVa697wfHhRMUGC7BJ9VIJaAEWf+LUoN7M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=t496lmJYm2fvbPyZ4Z4eizIdMm64dLp9tJzzrfgsm2LRfE1spmtq62ZTekHm5tjtSn5cXKDjxVVyR3YwJT9OLMeilMTc5r3pUgS2S4G/OmdmDLdcSaM6kypKYEOjVvYVEAepdLSizCgzBXtHNRXDBDK2Ej1t9M7Qh6h5fpUKkQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=UVTnGWNa; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60482420605so21795947b3.3 for ; Fri, 09 Feb 2024 14:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707517025; x=1708121825; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=EtUmW5C5jIEQG3Xq+wKcQPGgTDr9KsPcRaFSmsaaMus=; b=UVTnGWNapPTQj7nVfFqDl2/bgfSHmwVxHNZhcFzxA7vYkFq6lwX/jZfACJPcurBRyg G38buWkRMSGsiWw6iPjl00sFZCNjYdBw19qdBJirxaBRWiGkMrDdfdxYFOLq57XcR3IF 8ChRKcGDg/p9t6pK63ROYdf3j4ONq3rMZmtkvy34ZBib+CApXxppob4U2rJyNYbb5aGj eiaryjW9OKAynLTd4KE4FN9i2al6maxDaASNJVhK+mKEj1fqoc9HD5gxrb4+C1u4Vyoi ORgjK3PoDp870ie4tpIeSUEscuo4ThiwZe9AEH0Ls03wGUbnEzO+8PrgbuRJrmWbfFuC UrpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707517025; x=1708121825; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=EtUmW5C5jIEQG3Xq+wKcQPGgTDr9KsPcRaFSmsaaMus=; b=kWNo4oidEdnCIGOpz2iIHwUv2yEMZAGQ5ykpoIiTv2Avg1r1Ss9LGjDFGtE1paUinq YY4Ekv1dZRkTlCBqXqlKb6p05nazzsIYKGLc57WnWt32GCHZIM492/RDs4h8mSq5pSnM emZNNkKNrsP3bNi+aXrsnp3OcYO34CYCm91eR9rHtE68PI+6Hv+9V3aoAlrmJRcML7kG ZHI9cvBp2IXvx10U+5/FUABmNZ0Y1R9ARiFaGNiT6PblxmPyHCBVyGeRXYOmM+AAKib3 eM+0G+1kaKaQmYfs0snRlJ24YPgI+KxzcH2E+Ch168ZXsSWXaWXDK7AAFKgLIl/tBrXn fj2w== X-Forwarded-Encrypted: i=1; AJvYcCXnbFETyqZzXOrGNy/IHQhGadyofEJNSFWvHAMfv3LaH2hsL5SqgX3XVN0bvyffM3ohCYMwhQba56DtagOG14jtVIUXN50N9tFzuO4C X-Gm-Message-State: AOJu0YyB1aWOnFXbPHYjOFZ/xzg19DJRDQ2pgJaLaksbsOKE2iHvUZJs M7UlP3uNzTpx30CDl2y0p7wFqcISWFADdz8B3HrcUpj1Ig0DkcfoliGMT4G/6PHYpQ28W1aMZOw 3RQ== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a0d:e6cb:0:b0:604:4073:66ca with SMTP id p194-20020a0de6cb000000b00604407366camr98778ywe.3.1707517024940; Fri, 09 Feb 2024 14:17:04 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 9 Feb 2024 14:16:58 -0800 In-Reply-To: <20240209221700.393189-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240209221700.393189-1-seanjc@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240209221700.393189-2-seanjc@google.com> Subject: [PATCH 1/3] KVM: nVMX: Clear EXIT_QUALIFICATION when injecting an EPT Misconfig From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790461564693517044 X-GMAIL-MSGID: 1790461564693517044 Explicitly clear the EXIT_QUALIFCATION field when injecting an EPT misconfig into L1, as required by the VMX architecture. Per the SDM: This field is saved for VM exits due to the following causes: debug exceptions; page-fault exceptions; start-up IPIs (SIPIs); system-management interrupts (SMIs) that arrive immediately after the execution of I/O instructions; task switches; INVEPT; INVLPG; INVPCID; INVVPID; LGDT; LIDT; LLDT; LTR; SGDT; SIDT; SLDT; STR; VMCLEAR; VMPTRLD; VMPTRST; VMREAD; VMWRITE; VMXON; WBINVD; WBNOINVD; XRSTORS; XSAVES; control-register accesses; MOV DR; I/O instructions; MWAIT; accesses to the APIC-access page; EPT violations; EOI virtualization; APIC-write emulation; page-modification log full; SPP-related events; and instruction timeout. For all other VM exits, this field is cleared. Generating EXIT_QUALIFICATION from vcpu->arch.exit_qualification is wrong for all (two) paths that lead to nested_ept_inject_page_fault(). For EPT violations (the common case), vcpu->arch.exit_qualification will have been set by handle_ept_violation() to vmcs02.EXIT_QUALIFICATION, i.e. contains the information of a EPT violation and thus is likely non-zero. For an EPT misconfig, which can reach FNAME(walk_addr_generic) and thus inject a nEPT misconfig if KVM created an MMIO SPTE that became stale, vcpu->arch.exit_qualification will hold the information from the last EPT violation VM-Exit, as vcpu->arch.exit_qualification is _only_ written by handle_ept_violation(). Fixes: 4704d0befb07 ("KVM: nVMX: Exiting from L2 to L1") Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/nested.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 994e014f8a50..1eebed84bb65 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -417,10 +417,12 @@ static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu, vmx->nested.pml_full = false; exit_qualification &= INTR_INFO_UNBLOCK_NMI; } else { - if (fault->error_code & PFERR_RSVD_MASK) + if (fault->error_code & PFERR_RSVD_MASK) { vm_exit_reason = EXIT_REASON_EPT_MISCONFIG; - else + exit_qualification = 0; + } else { vm_exit_reason = EXIT_REASON_EPT_VIOLATION; + } /* * Although the caller (kvm_inject_emulated_page_fault) would From patchwork Fri Feb 9 22:16:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 199137 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1163439dyd; Fri, 9 Feb 2024 14:20:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnLus52sQY5d/a1KukkFs3aJKcpA05GKGQ2EXWW+3nZ3fRoNKfAnt140fj476Jco+sI7LL X-Received: by 2002:a05:6830:1603:b0:6e2:bb44:10f5 with SMTP id g3-20020a056830160300b006e2bb4410f5mr420252otr.15.1707517259144; Fri, 09 Feb 2024 14:20:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707517259; cv=pass; d=google.com; s=arc-20160816; b=awVZXQvKnEjhdf3ODEeHR43bLZ++fSep3/ymMEKjtWk94bZIUbR/5fejdPh1zYlr5y LMF1txXFhzlrn5suvo5I7TZ1TGcI05brQ8HcXz2mhSWpQbus9ECnXkkBToyKBTU4nuk9 rswdJC+Cg6hVf4aEQ1M7hHYY+uAM8WcZy3DvwFa2pVzuU+eoRdMhAj98posQKA8Axijv L2Yr65GdG0u/AstJ43xyyK7XfQPOvmbXkHNrr/zK4zy+0Hi9huqvmcQud+hSXlYPI99D R60qRJo57icZ5YyaSHGIV2eBQXR4hpVCt2JyZjFyOsuY6hDQqFJMmrN3I69Mn4tCuh79 hBYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=mZnCItuDvbZkdQunBsA68aRkk/hge2O9/C7d+7lVbaA=; fh=oJ16AoX4Pk+RjXXMkOwGRMPVjFhAr8u4ThzJBGQOLZM=; b=VJ8iX9r+kN1Jk99dB4LLB9Einfvs7+BbeM7TGyOX+EOTiZRKGvFlc/kNU2tB64SYwF oCtxE/PUtQeYjYf8ySDcfJc2OGkgZ9rtlum6dbKN7m5Vy6MPS4nYVmAAxsWWIK7JZaV3 G8lbcRantyxnp4RIcd3xg/xt6vjGmqFWDTDITkbn9zNu4dr4/Ln4PRTFfiu+K6XZh5Zu QqZal8N2xp5bBGRkA0+6c8gLB0bZIA84f1BZpwiLm1EH0SXqdtltiFl6H5cdBD9GyS9O n+BWmHPsWrLtjJLD3l3N6cKLitCHo5NePliy4YtdiKQry66d3vUEk4yZRzgGhKSe4R8n Wx3Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OsOg8o9F; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-60089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVomm7NKlxkbHkkRQIOJJDbHADa6xk37NLYfe68u31LSZgewPblrQJt3O+ZQ57na3Z2SRKqjOnVJNkfLAXu9GwHevBhWg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o6-20020a05622a138600b0042c450a903esi2864529qtk.578.2024.02.09.14.20.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 14:20:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OsOg8o9F; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-60089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DCF501C21B45 for ; Fri, 9 Feb 2024 22:20:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEEBC3D3B1; Fri, 9 Feb 2024 22:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OsOg8o9F" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D87BD3B1A0 for ; Fri, 9 Feb 2024 22:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517030; cv=none; b=WLOt4t2BI6MDSzz2EqB7yQjOfo11GoEAhfxyKh4T1ZnmClRmWZSMP0MPSsjjFHH7IVe3IFi5DYWkhpMrxw4a2qiy9ZpACBegq8FDgvxHTqj9Tkt5PHfbUQ/MOYMfpdeqqDQd6e6XXjOdQFj3sOLycV93yg+vxYhRuYBXrAVQal0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517030; c=relaxed/simple; bh=m+yWYZl+6lZDOPSuIdLV5f59M0wUnPDZJiBRg1Mk2Ys=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=GYdOzLzue6DHw4hMhdIXBZEUE9SDNGplo8okbpjad2uHDfI+Q0qoD7YyrKiz3SnWswsPHELXg9V379g8DNGtftkpIltsD4RW7PQvAMEYspiuFC9yq1NMJpX63rHeVJ4/I9hTHXKNwtXE/flMVeyqTMsJLhnFT9ql7Cr5ScNnIjI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OsOg8o9F; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-602dae507caso27271847b3.0 for ; Fri, 09 Feb 2024 14:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707517027; x=1708121827; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=mZnCItuDvbZkdQunBsA68aRkk/hge2O9/C7d+7lVbaA=; b=OsOg8o9FSAY+COwOunvTqVB6HEDwfvnuw8wuVq1CNyCzrkFAkyG2t6bPpkls2pIz02 UjxPu9U/BKE6D4sHuQR1l0HJ7VxlDMatJtxZXvPKN0KkdiDUbLSjKBaUGVk3Nvx0LIPP X4JdP8Q0PW307h7lmZaUo7oSrHmmL3Rbl11K3Xm8PSiBE4MBl9InqIH0yCqP3fNleDvc cGZptsW2xIX5shNynInYQFwIYPPdLbGQfwUJAMQy6LFMjfdWSmCq9XshcrbYsKmck+Rc uthntkNCGsNAnhIV8wy8PdqUGL3mapKcnnTS5YRrU2cVclK2hJWgi66A43psmAAV2Cl+ gKYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707517027; x=1708121827; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mZnCItuDvbZkdQunBsA68aRkk/hge2O9/C7d+7lVbaA=; b=KlvNB7oE+ZtPSamNruS2VHvRye05yW9QZtt7JDLKWB8neFv/QjHtPR+BvpgmbJM2+o TcmBEVY0xgBzbUkk4KYG9fEfjnQIM+Xx1MPiLOuT9pi10C0vg1l7i9eKPBs06Uz2crQP Cx5ZllcegCK4c6zWQn1c3b5SGIhF2wHFMCi8eKSkIIt8Ni+CQTc1p0uPFMbU7aP2R7aF XafdTszQzzDFGK+S4ZpzB7u3uI0VgfjRhaurihD+70bZ9Nn7ifwmxAPdW1ncEHYmaNhi zMb2x9SkhdjV14P63UKA7URldPjD6qXMhroyuo28fzoZs9RrGlB1B3pYFwYFmDmHxqsf sOvw== X-Gm-Message-State: AOJu0YyOOFqoLIBT4cy00uHhjDvW18gXapeZseDwjFcTHgIaqGRkC+Yn 0YgWYLj8wHB7EJb/h4aRpZ+kghmhnNS9HixWZVJEEjUpCpNiGQY6MZQ2gIV7twsWY3ISU5v9Kw7 CpA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a25:9c08:0:b0:dc6:f21f:64ac with SMTP id c8-20020a259c08000000b00dc6f21f64acmr114763ybo.12.1707517026937; Fri, 09 Feb 2024 14:17:06 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 9 Feb 2024 14:16:59 -0800 In-Reply-To: <20240209221700.393189-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240209221700.393189-1-seanjc@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240209221700.393189-3-seanjc@google.com> Subject: [PATCH 2/3] KVM: x86: Move nEPT exit_qualification field from kvm_vcpu_arch to x86_exception From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790461617560367621 X-GMAIL-MSGID: 1790461617560367621 Move the exit_qualification field that is used to track information about in-flight nEPT violations from "struct kvm_vcpu_arch" to "x86_exception", i.e. associate the information with the actual nEPT violation instead of the vCPU. To handle bits that are pulled from vmcs.EXIT_QUALIFICATION, i.e. that are propagated from the "original" EPT violation VM-Exit, simply grab them from the VMCS on-demand when injecting a nEPT Violation or a PML Full VM-exit. Aside from being ugly, having an exit_qualification field in kvm_vcpu_arch is outright dangerous, e.g. see commit d7f0a00e438d ("KVM: VMX: Report up-to-date exit qualification to userspace"). Opportunstically add a comment to call out that PML Full and EPT Violation VM-Exits use the same bit to report NMI blocking information. Signed-off-by: Sean Christopherson --- arch/x86/include/asm/kvm_host.h | 3 --- arch/x86/kvm/kvm_emulate.h | 1 + arch/x86/kvm/mmu/paging_tmpl.h | 14 +++++++------- arch/x86/kvm/vmx/nested.c | 14 ++++++++++++-- arch/x86/kvm/vmx/vmx.c | 2 -- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index ad5319a503f0..7ef4715d43d6 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -993,9 +993,6 @@ struct kvm_vcpu_arch { u64 msr_kvm_poll_control; - /* set at EPT violation at this point */ - unsigned long exit_qualification; - /* pv related host specific info */ struct { bool pv_unhalted; diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h index 4351149484fb..b5791a66637e 100644 --- a/arch/x86/kvm/kvm_emulate.h +++ b/arch/x86/kvm/kvm_emulate.h @@ -26,6 +26,7 @@ struct x86_exception { bool nested_page_fault; u64 address; /* cr2 or nested page fault gpa */ u8 async_page_fault; + unsigned long exit_qualification; }; /* diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h index 4d4e98fe4f35..7a87097cb45b 100644 --- a/arch/x86/kvm/mmu/paging_tmpl.h +++ b/arch/x86/kvm/mmu/paging_tmpl.h @@ -497,21 +497,21 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker, * The other bits are set to 0. */ if (!(errcode & PFERR_RSVD_MASK)) { - vcpu->arch.exit_qualification &= (EPT_VIOLATION_GVA_IS_VALID | - EPT_VIOLATION_GVA_TRANSLATED); + walker->fault.exit_qualification = 0; + if (write_fault) - vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_WRITE; + walker->fault.exit_qualification |= EPT_VIOLATION_ACC_WRITE; if (user_fault) - vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_READ; + walker->fault.exit_qualification |= EPT_VIOLATION_ACC_READ; if (fetch_fault) - vcpu->arch.exit_qualification |= EPT_VIOLATION_ACC_INSTR; + walker->fault.exit_qualification |= EPT_VIOLATION_ACC_INSTR; /* * Note, pte_access holds the raw RWX bits from the EPTE, not * ACC_*_MASK flags! */ - vcpu->arch.exit_qualification |= (pte_access & VMX_EPT_RWX_MASK) << - EPT_VIOLATION_RWX_SHIFT; + walker->fault.exit_qualification |= (pte_access & VMX_EPT_RWX_MASK) << + EPT_VIOLATION_RWX_SHIFT; } #endif walker->fault.address = addr; diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 1eebed84bb65..4d0561136e70 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -409,18 +409,28 @@ static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu, { struct vmcs12 *vmcs12 = get_vmcs12(vcpu); struct vcpu_vmx *vmx = to_vmx(vcpu); + unsigned long exit_qualification; u32 vm_exit_reason; - unsigned long exit_qualification = vcpu->arch.exit_qualification; if (vmx->nested.pml_full) { vm_exit_reason = EXIT_REASON_PML_FULL; vmx->nested.pml_full = false; - exit_qualification &= INTR_INFO_UNBLOCK_NMI; + + /* + * PML Full and EPT Violation VM-Exits both use bit 12 to report + * "NMI unblocking due to IRET", i.e. the bit can be propagated + * as-is from the original EXIT_QUALIFICATION. + */ + exit_qualification = vmx_get_exit_qual(vcpu) & INTR_INFO_UNBLOCK_NMI; } else { if (fault->error_code & PFERR_RSVD_MASK) { vm_exit_reason = EXIT_REASON_EPT_MISCONFIG; exit_qualification = 0; } else { + exit_qualification = fault->exit_qualification; + exit_qualification |= vmx_get_exit_qual(vcpu) & + (EPT_VIOLATION_GVA_IS_VALID | + EPT_VIOLATION_GVA_TRANSLATED); vm_exit_reason = EXIT_REASON_EPT_VIOLATION; } diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index d4e6625e0a9a..a24fba6b7741 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -5771,8 +5771,6 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu) error_code |= (exit_qualification & EPT_VIOLATION_GVA_TRANSLATED) != 0 ? 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 From patchwork Fri Feb 9 22:17:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 199136 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1163373dyd; Fri, 9 Feb 2024 14:20:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKCT/C6wnHKrDFSjP+zjHxJWSDfjpnl2PPwUkzzz8Nmj7OejtywY0hxpDkABA5D/6LahFS X-Received: by 2002:aa7:de18:0:b0:560:e910:53b6 with SMTP id h24-20020aa7de18000000b00560e91053b6mr150286edv.11.1707517249684; Fri, 09 Feb 2024 14:20:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707517249; cv=pass; d=google.com; s=arc-20160816; b=opg23FIfziYRXnROytIgxHRYpYIeV2hemYSoDfBsVFcgr5TSZC8tmRZhuZrjnpoic8 Op1xTZxTFWYKrh77LNdkdUE09Uu1Meay3yppMuSX5Xm6+cDP+efg1yHYH6zPiE3V57Vh M/TI7UMqBLByG5qSlyROZWbhw1yfC8Kfp0wqCmM9sShScUUsa6I/1dnTodv/DQ5kE1A3 S/7WIBIzhNSX6lqIQ5dmmKLfaZKr1hk9fxlWJjCbhwB5WIHgc7M6NCqnaYX66W98PJiS 8adQuCd6popVJwbGccW+5G2jt/BBCn+sqJv+yKEoRXY4+wDJ/PgQS6ZPRY0lQanP/utm pmjA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :reply-to:dkim-signature; bh=xriXj5ETw+SM6HIrjBhtRYR+FpAUxlK2qVu7eV3/IuU=; fh=iFXXd/TDHEs7dbXVnfe35nocnat2JmZabToHwIte7UU=; b=amKYaKsdrjHONHz0pus6FeuPlP6o4k293k+SeiU7s2sFUW2rOnI/WejS3hLw6/mShs ItEx59kjMbwPv9g6N+aS0FbhQQb/O1YyV1QTheTEq6RIddoogmSyJA7mQY+ftd0Lpn6d k4w++3/t2uA+D6x5zPN2GkGeYvgEhzChq4ebgw13DTDD2EKHJO62tsvXFY3PK13faLLw pura89uItjAtkuSODXjyA9qPzrVHZC3C0FWX0pNJSvWhanRkDETMvOA+U7Jwg+uFGYB4 gjgVIAteClUFWsjJEmYaOXOVyPqpp3l3M7yL20lgrLtWO3NBhFojcfKDK96U/pWdMnBg W1aQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GLAyxBTW; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-60090-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60090-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCX+JMm3GynV9xK97/zebjZxIGsMUi22G5Px0sR+UXkCV2m+1rxNtfJCIAChXYVah9C0cegjSUXw2gEAFlhyvF7iqeKg+w== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a17-20020a05640213d100b00561601cc827si158405edx.14.2024.02.09.14.20.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 14:20:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60090-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GLAyxBTW; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-60090-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60090-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4664F1F24E3E for ; Fri, 9 Feb 2024 22:20:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD5C73D3A5; Fri, 9 Feb 2024 22:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GLAyxBTW" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C24C3984F for ; Fri, 9 Feb 2024 22:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517031; cv=none; b=BvvyMKOvOhQoQNVqsk6WJSChAHRTekQcO33hGIHX3w90DxcZYebGhATYSzX4KuTFYn6Y9WRozWUZnVtkQ1S3LnkEfcyccdVmoq/BAKok4I0rdwU4I93Jdk9XgLpHiq7+di8LEgK1QPjlK4J/01zWRDPy6axhX9XUqk65vEw3CQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517031; c=relaxed/simple; bh=5ROcmTVvSgXvIbGuiN/CZtA5rWbe5pIknCwUED8ic5c=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=vCdEF5RxzvS7gnFtFUaDSFak9s203S36V+m1xoOBKh9dn+x9VXqUikaCFn3t7Ufm2P3Z5OwDw/JKzvjOgVR5NDL5jH3021dEr5h5hg6WMf2aAGAwNU/008cj4ZC5oNuaXTlZRAxu0u6iuGCB/hwSqMLK4Kd+Q6i2FPw90Rxr9eM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GLAyxBTW; arc=none smtp.client-ip=209.85.128.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-6049520940dso29909037b3.0 for ; Fri, 09 Feb 2024 14:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707517028; x=1708121828; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=xriXj5ETw+SM6HIrjBhtRYR+FpAUxlK2qVu7eV3/IuU=; b=GLAyxBTWGWdBIiHRzZZ2cDdHVFRWzPWB0gVp6BnC9IrZBal8Uom1oqFhpI+RXcY6cX I+iz04yAbfy9jFA7RMYaSJMP1h1uw1jE+d3N/zVMVfFoh2yV0WL5zJw+vBIhc9XANZvb zT1igYLPYy1oqbKNCf9NNkTNTyRBJRtVONL7AVmLMNS4UGi1Pxhq77N9UEzHsyeey99s 5oIuiN2nilmffCHvWblbG2yfFPopqqu7XgCaYn8QcjEdnQqwuj1Jf62Fg20DMP2iW9tN ZK5gNr+mZbtg9/HAKOuiCBkd6qR0G0gTT02qUbRcfV1IQRIocC0UfDTJJt9GPN2pbzeJ 3Mhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707517028; x=1708121828; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xriXj5ETw+SM6HIrjBhtRYR+FpAUxlK2qVu7eV3/IuU=; b=uFPl2xlgWuNQCEmOx0yok90hW56G8wAE7u17I7kE2te/dHKAII0NwlpHIfQMK/TYdF vAVR5QJw8nkY//vrSrHyh9PWgjY7I/MWcfnXucUxET1sfRPZpOOKLFpCNTmlFW1clrVo JRzW/UPqJi/sghB0bvAaG62lKR8dhmuPVQGdZhYtU7tNQbecDphqDopoKZtTxf/hDIW2 bV87P1VfPricTRV1eV4d3N+HUQyiGMYIicop9vl/vcAGgcKMQT5IGbRTy/Vy82UVkTNx y5hlUcdu7Fsl6/RTjj6F2xtioWzf855bP/4FCQCIYB5Laye1NkPOPgIOLz8t8eBwLUYI FzMg== X-Gm-Message-State: AOJu0Ywy0/mY4z1AcjGfnfGMKjvLABl4APFJmSYTozSHGM9doxKQoEfV eq1yu/rrbj4HyCf0tn+VS7CciXRqR442xoM1FVfsKfbvH6IjrMWh4BXBh6d0WLbMWix9yGGPYT7 1Vw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:690c:d82:b0:604:ac3b:75d5 with SMTP id da2-20020a05690c0d8200b00604ac3b75d5mr123597ywb.7.1707517028741; Fri, 09 Feb 2024 14:17:08 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 9 Feb 2024 14:17:00 -0800 In-Reply-To: <20240209221700.393189-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240209221700.393189-1-seanjc@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240209221700.393189-4-seanjc@google.com> Subject: [PATCH 3/3] KVM: nVMX: Add a sanity check that nested PML Full stems from EPT Violations From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790461607580665040 X-GMAIL-MSGID: 1790461607580665040 Add a WARN_ON_ONCE() sanity check to verify that a nested PML Full VM-Exit is only synthesized when the original VM-Exit from L2 was an EPT Violation. While KVM can fallthrough to kvm_mmu_do_page_fault() if an EPT Misconfig occurs on a stale MMIO SPTE, KVM should not treat the access as a write (there isn't enough information to know *what* the access was), i.e. KVM should never try to insert a PML entry in that case. Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/nested.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 4d0561136e70..29df186dac84 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -416,6 +416,16 @@ static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu, vm_exit_reason = EXIT_REASON_PML_FULL; vmx->nested.pml_full = false; + /* + * It should be impossible to trigger a nested PML Full VM-Exit + * for anything other than an EPT Violation from L2. KVM *can* + * trigger nEPT page fault injection in response to an EPT + * Misconfig, e.g. if the MMIO SPTE was stale and L1's EPT + * tables also changed, but KVM should not treat EPT Misconfig + * VM-Exits as writes. + */ + WARN_ON_ONCE(vmx->exit_reason.basic != EXIT_REASON_EPT_VIOLATION); + /* * PML Full and EPT Violation VM-Exits both use bit 12 to report * "NMI unblocking due to IRET", i.e. the bit can be propagated