From patchwork Tue Mar 2 18:45:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 12113059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E8ECC43381 for ; Wed, 3 Mar 2021 07:23:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8BF1B64ECE for ; Wed, 3 Mar 2021 07:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380658AbhCCHSZ (ORCPT ); Wed, 3 Mar 2021 02:18:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1581630AbhCBTA7 (ORCPT ); Tue, 2 Mar 2021 14:00:59 -0500 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3749C061A28 for ; Tue, 2 Mar 2021 10:46:11 -0800 (PST) Received: by mail-yb1-xb4a.google.com with SMTP id i2so23705022ybl.16 for ; Tue, 02 Mar 2021 10:46:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=UoSJXw/PVEOjBFScqgNo0bQzSNuTFSWEQtCbZglmTq0=; b=lwgXT6FI8+/1UT8FGrjiTavPAr0JKYB0UWbkjGqt7EyPK3rhZ6rAiI6lBmAT7WA898 e0BEX/4xziKzMBSqkmjDozDuK5WnSHbDOG+eR8mInErGT+TbXD4at9EZnRInk/6rb9Cj BoWKjo0tzn+DwYSsG3imVzuTgoRlC9M73YKnNUSMR+8Dj0WsiVXdxUzAj8myq/vzRXr1 dlkurnV+eEAgGbSZqtYSHfu24HYZ4G8kXJNHvvkHlFaVk9DfSsXczRU+W1HualcuLUee z8dBZsxRkZ8lBY3j721lFPn5lJZj3po3y/bOCrwt906AIJwZK7pyl4iQRnxw+/q2k0VD 055w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=UoSJXw/PVEOjBFScqgNo0bQzSNuTFSWEQtCbZglmTq0=; b=O3kDAwVZTyA/Uqyih1Y5yocLa8Aa0RV28q66E2lKommjI+wQtF3Ak8Kaij7KWhvlfs G7KHH0f0JiAD7Bt10XHk9GcNfo25pDiLjQ9agui2r1cW9ycpZ/l8Tfgqd11+kLUhFP3w VqEotCOlOKdPgza9PCW4MxqvJkd6EaD75jD6gUg70r6FkbOY+OoNKYYTV42TYf1vIGhc GgMBPc/gYTV7PacF6nqwQ/dL1LCgOGAIpJBUJjdbcn0oJnGqXQo+/hdraaiSutVMHqEv EL3eKO6RVqW45TaI7sg9D0n/ckCzom9PzbQ++JIftmboC3I2E6dzCHU7nFPU8Z6VPI7V 7Ubw== X-Gm-Message-State: AOAM531wIRKFDdmd5BTQQt62YEli/dyB2IJXFuPA7a1GG9Gdy9B46oWv 215+n32YJfuw4JxZUYXIfYTpdrV3twA= X-Google-Smtp-Source: ABdhPJxXp9gj3TQbYMpbnDiuJU1nyT2DyJMbSHnnOW+armBYCgjzJRMfMkf1ZDQJr9aOpisAIIbUxejbTis= Sender: "seanjc via sendgmr" X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:805d:6324:3372:6183]) (user=seanjc job=sendgmr) by 2002:a25:76c3:: with SMTP id r186mr33750361ybc.365.1614710770992; Tue, 02 Mar 2021 10:46:10 -0800 (PST) Reply-To: Sean Christopherson Date: Tue, 2 Mar 2021 10:45:35 -0800 In-Reply-To: <20210302184540.2829328-1-seanjc@google.com> Message-Id: <20210302184540.2829328-11-seanjc@google.com> Mime-Version: 1.0 References: <20210302184540.2829328-1-seanjc@google.com> X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH 10/15] KVM: SVM: Don't strip the C-bit from CR2 on #PF interception 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, Ben Gardon , Brijesh Singh , Tom Lendacky Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Don't strip the C-bit from the faulting address on an intercepted #PF, the address is a virtual address, not a physical address. Fixes: 0ede79e13224 ("KVM: SVM: Clear C-bit from the page fault address") Cc: stable@vger.kernel.org Cc: Brijesh Singh Cc: Tom Lendacky Signed-off-by: Sean Christopherson --- arch/x86/kvm/svm/svm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 4769cf8bf2fd..dfc8fe231e8b 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -1907,7 +1907,7 @@ static int pf_interception(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm = to_svm(vcpu); - u64 fault_address = __sme_clr(svm->vmcb->control.exit_info_2); + u64 fault_address = svm->vmcb->control.exit_info_2; u64 error_code = svm->vmcb->control.exit_info_1; return kvm_handle_page_fault(vcpu, error_code, fault_address,