Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp778254pxp; Fri, 11 Mar 2022 14:54:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJx91Y0mBNdWRH/u9O5Z5QVPNJwRz4xD/RGovkZAbARVrmyPrCij961N/uOIOhil723MjhTQ X-Received: by 2002:a17:903:31d6:b0:151:bcfd:7e20 with SMTP id v22-20020a17090331d600b00151bcfd7e20mr12379304ple.92.1647039280385; Fri, 11 Mar 2022 14:54:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647039280; cv=none; d=google.com; s=arc-20160816; b=WxiFPCLG2MihpjdeQwCz3VWWKKtdxup8DMWqSGTCle1RJnLbj9dmbUY61im+8qQqa0 k7x6WOv9G4dSQ/uEvECPL+RMuj+5+gCsnw4Fkqg3i2Y5rszMXBVSj+7f+imw78uQDpg5 7Vlc5F5cD0R248rk9B2BYyR7pGFJA2C0WEmOfLOHNgK1tZgVDWmmr31yWwntZLHFhKPn GqMB9SI519hquPdOKHg1Ai7VuHPT9Ymv9zndpekWkoZW0qosrRTA/BI97ytiLq21zAL0 3Sv1Uaz0qwmU2JISH1CTDK2MdV9EMKMAtmpHiFNEpiWFOV3ORrRV9YNrrjHD/OkNkSEh SCHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:reply-to:dkim-signature; bh=hDEsiW/1JCBAL6rnpjAoAKowK88eFadHJbQ+k7mmB9A=; b=O/14SQWBDCeWMuTbEvHBGIeZCgAs1XkkGCRx3N/+P68VU56YRbBsvC6xTsrPlkYb1C SNqC74Rk23NdDOmp6Von9gFdd/k6JlBVTpdTkbvTEVc5OfGr8tKX629ChOCXD8YMVsvz O4Apf7/NBbX2k+RlegbK7fb9ETfPmSNVOyaZIIEay8NJZ1H26nP4zNin4Wa94LPjQiAp qSjkSQhvrwgVpavDBwpc3HAa3egP57FHBaFl2CRDLbqb0fX9DD/JriT+YRNY0mpYaCEg L+JO3QndBGhAhRFICOaL6XYr7NkhZV1VRyF5vYz55XK+7vLJVgBtU9sBO5DZ9lMPkyrd Xp4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RFF8YW6U; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k12-20020a17090a9d8c00b001bfa1bb3d30si9108574pjp.114.2022.03.11.14.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 14:54:40 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=RFF8YW6U; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4583135FEAF; Fri, 11 Mar 2022 13:52:35 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346141AbiCKDaF (ORCPT + 99 others); Thu, 10 Mar 2022 22:30:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346114AbiCKD3o (ORCPT ); Thu, 10 Mar 2022 22:29:44 -0500 Received: from mail-pj1-x104a.google.com (mail-pj1-x104a.google.com [IPv6:2607:f8b0:4864:20::104a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8764EEA51 for ; Thu, 10 Mar 2022 19:28:22 -0800 (PST) Received: by mail-pj1-x104a.google.com with SMTP id p5-20020a17090a748500b001bee6752974so4417916pjk.8 for ; Thu, 10 Mar 2022 19:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=hDEsiW/1JCBAL6rnpjAoAKowK88eFadHJbQ+k7mmB9A=; b=RFF8YW6U9Bnsdg9ppIYdODr3twU98mGctgU6cl8f3boBCowDbMpo4eeue3p4MdWSAa Np0Tk6nTzyjg/sEQU+UR2QiiO6C8feFoVBL7/Y0GoWRFEgnprHnc6zXbr+57unQbg+np p0RKvMzLCgSglH5rGIauZNKXmiV4jtNhKYAg1rTY6ZTFO8dJD9j2oM83HenlbGmp+ImU 1+gqT1Bkr7JdXwCHbdixFiuOOWrFCzmT5TwRAutxA1YQxwvDD5zE0JU8GSQAaDL7tr1a u2ewtiIGWsw3pGrmLNImaBnmXeGnzi0UHAbwqBv0MPeUuWUnf0mdg3FRmwGHI6aZcSIt Ayrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=hDEsiW/1JCBAL6rnpjAoAKowK88eFadHJbQ+k7mmB9A=; b=OpMs4d4/jJXLkog0Xc4/bIxkmRmD5t0ikwxFcbQxaelpxY8msziyWgdR6QbJL759p2 qqacPj0fnUX9kpoAu0ly8oqAgEF7444iYeacqG5zSgWmWkIiSdgMJj4zE9mKmpX48t48 SaMjaXXUJelvTecei2vy4wEIjS0rhzLgq/VYnOCuCZeA9dmyqYrW5KfRXDk7H+xkShxY K+u7bHFuwdv8SqEpZmIT/EqDQwkxn4iA8OJOG5IYTZzNrh56zICVw68hRl54yDpGHSAV q9RKcr9IHobDXVFc2Qu+8gcKui8NakcOnnkt/a7iyDwVFyGSfg6UDqUJMGUGsMp9yjhw xZOQ== X-Gm-Message-State: AOAM532G9Ke0brfTOeXLwf1jsV9SI9v4H5W5xypJRsbkCgWIsq+Gb6Sa 0ONrIXZgPtdJ9T4AefiKban+/dmMkhA= X-Received: from seanjc.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e5]) (user=seanjc job=sendgmr) by 2002:a17:902:a3c3:b0:151:ec83:d88 with SMTP id q3-20020a170902a3c300b00151ec830d88mr8717054plb.9.1646969302136; Thu, 10 Mar 2022 19:28:22 -0800 (PST) Reply-To: Sean Christopherson Date: Fri, 11 Mar 2022 03:27:51 +0000 In-Reply-To: <20220311032801.3467418-1-seanjc@google.com> Message-Id: <20220311032801.3467418-12-seanjc@google.com> Mime-Version: 1.0 References: <20220311032801.3467418-1-seanjc@google.com> X-Mailer: git-send-email 2.35.1.723.g4982287a31-goog Subject: [PATCH 11/21] KVM: VMX: Inject #PF on ENCLS as "emulated" #PF From: Sean Christopherson To: Paolo Bonzini Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Upton , Peter Shier Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Treat #PFs that occur during emulation of ENCLS as, wait for it, emulated page faults. Practically speaking, this is a glorified nop as the exception is never of the nested flavor, and it's extremely unlikely the guest is relying on the side effect of an implicit INVLPG on the faulting address. Fixes: 70210c044b4e ("KVM: VMX: Add SGX ENCLS[ECREATE] handler to enforce CPUID restrictions") Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/sgx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/sgx.c b/arch/x86/kvm/vmx/sgx.c index 35e7ec91ae86..966cfa228f2a 100644 --- a/arch/x86/kvm/vmx/sgx.c +++ b/arch/x86/kvm/vmx/sgx.c @@ -129,7 +129,7 @@ static int sgx_inject_fault(struct kvm_vcpu *vcpu, gva_t gva, int trapnr) ex.address = gva; ex.error_code_valid = true; ex.nested_page_fault = false; - kvm_inject_page_fault(vcpu, &ex); + kvm_inject_emulated_page_fault(vcpu, &ex); } else { kvm_inject_gp(vcpu, 0); } -- 2.35.1.723.g4982287a31-goog