Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1793568pxy; Fri, 23 Apr 2021 17:51:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxDS0B/7l9rFzclU/P89cp/9z0S/bG3qgbges4GtJB4l0S6RgHG2nmwJn+1CttV6jUCkR3n X-Received: by 2002:a17:906:c218:: with SMTP id d24mr6744943ejz.363.1619225461878; Fri, 23 Apr 2021 17:51:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619225461; cv=none; d=google.com; s=arc-20160816; b=uMwNHTo6wlmY2OgQ5pydujr4sHYjsjiLAjZDvr6qfh/EbLgF9l4gwbjt4sLkABcxlf V2Wuiyc6FYyq8XtqBC2rQYjIdcEHvvwGzBebgToWb8FLWD5U96m4wKcC5DeJb0zCZxTg iILfUDUYscDOlgOl1Gv8b43oZPOZVHkoCIU9GVibPYCfSbcP+WjTGpIbjwijkasA0vzR BfjvXrrAkaUbnXnVc/T/9BbFpzmNc0qUarNsr1bgTU/8rGNm1iFEqCXvs5AGHTWAmE7h lRHG7owoRe8a+GPIcCMzOioHNZqpYjlvqSbRqOkZh7TIzS5Kz5iM7f+Dh+zsriPi64bd OQ0Q== 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=RHGsqWwH1zxHj0xIe8K4VtoI6F8/53X2i4hvFea/Jtc=; b=ZimxA9e4pH+GmMNwnIDMKDuiztSQusa9EBPLXDXx1pplWPWDalbvcbtzakBDSUPWMV bGvahbZcHU32tnbGf1ePiAPt8ocE2hsCIe8e4F5hp/99CrOzm0h2mJ0rRFvXDP8NCV8Y 1HI2Cshj4JF333pycxNYImtHx/EI7yX4wbntvemFeJcZNIxpUUrAF7Xla2miOp/ImJAI 3ry4LYnNQMBN11n/azwDO9jPmX+4nbi0Ikvd9w40gROoH0OPp55s/o206yw7BjAotdsk pnXs4VxurYbWABjA7WtluTJNTWDMj0uV/pmUrX8SxuAp3IGrmtwnxCeGmeqOK2sR4KjK VsZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=OPjwaJ3Y; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u13si6742874ejt.333.2021.04.23.17.50.38; Fri, 23 Apr 2021 17:51:01 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=OPjwaJ3Y; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243971AbhDXAro (ORCPT + 99 others); Fri, 23 Apr 2021 20:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237243AbhDXArl (ORCPT ); Fri, 23 Apr 2021 20:47:41 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C627AC061574 for ; Fri, 23 Apr 2021 17:47:02 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id v63-20020a252f420000b02904ecfc17c803so15026548ybv.18 for ; Fri, 23 Apr 2021 17:47:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=reply-to:date:in-reply-to:message-id:mime-version:references :subject:from:to:cc; bh=RHGsqWwH1zxHj0xIe8K4VtoI6F8/53X2i4hvFea/Jtc=; b=OPjwaJ3YTXeq24If+8hQOW0VyJ+bADxa0ZRW5sPafB80mG4gzK4fam3t9CjRIQWl7T wGw7HJd4vszwt8ioG7VoGFwsLhoabf0qd/kaDt6vxb6365MyOLPhCdgvplw3BaMQ2qs8 No6dsSgvzPfQcYF09OgMhnG4ahp0tp7RHLuXXmJ8jKSi2UmICvWZbzP2d/nJLz71SmY9 lWxco2nnDLF9nUs8asjapZgxqWC9N3Z/d9gP+9Gmrj6EzMj0uHmP/G6vRkJPYNyoVxgz 5l+Kvb6xbV4lSKxLTbI/+68iCD6p8msMn5HQemfW0SzONRC/SXhKoPbgtQYkTQWLFvJy O2cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:date:in-reply-to:message-id :mime-version:references:subject:from:to:cc; bh=RHGsqWwH1zxHj0xIe8K4VtoI6F8/53X2i4hvFea/Jtc=; b=i0CSVQ4Exb3crp2LWlCl/mrQ5oCjhc4aq72+OVstEBoTu76IleNJq77nQokRSXLdHN lcn+doMxvn/9+hH1tX4P8kam/ged5ndm6aaE6NL55caeT3ekb4/BSCRPKFXAuWpNxo4y WLPRuu2QEQd/Yn9fmrwl81/zwJurFkt8e6E3XmcS8diZhf6AVSFvtTCJMoFHkfQvqFLd fZ5Xj+iHRFgG8Lxy6DPAPShv8nxRwcqBavMDxCwcxnIIQmM633hI2g4E5/CfQJd7qpKz 3LzvV64oxIWgneDn+ljmDjkPOQI1l7r7s1OktoyuqXlodV8oNxGQ4lNQU0AqaRK3bmDE 8+Jw== X-Gm-Message-State: AOAM530oqrcb4/WfgH5oVOa1eDdj50Xs7ujv9OceTO9ApjZLqFJPaT9s 0OAMCXYokHFRhRSq6bC6dW1I4+hhC4Q= X-Received: from seanjc798194.pdx.corp.google.com ([2620:15c:f:10:ad52:3246:e190:f070]) (user=seanjc job=sendgmr) by 2002:a25:ac9b:: with SMTP id x27mr8963271ybi.120.1619225222104; Fri, 23 Apr 2021 17:47:02 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 23 Apr 2021 17:46:03 -0700 In-Reply-To: <20210424004645.3950558-1-seanjc@google.com> Message-Id: <20210424004645.3950558-2-seanjc@google.com> Mime-Version: 1.0 References: <20210424004645.3950558-1-seanjc@google.com> X-Mailer: git-send-email 2.31.1.498.g6c1eba8ee3d-goog Subject: [PATCH 01/43] KVM: nVMX: Set LDTR to its architecturally defined value on nested VM-Exit 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Set L1's LDTR on VM-Exit per the Intel SDM: The host-state area does not contain a selector field for LDTR. LDTR is established as follows on all VM exits: the selector is cleared to 0000H, the segment is marked unusable and is otherwise undefined (although the base address is always canonical). This is likely a benign bug since the LDTR is unusable, as it means the L1 VMM is conditioned to reload its LDTR in order to function properly on bare metal. Fixes: 4704d0befb07 ("KVM: nVMX: Exiting from L2 to L1") Signed-off-by: Sean Christopherson --- arch/x86/kvm/vmx/nested.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 00339d624c92..32126fa0c4d8 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4276,6 +4276,10 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu, }; vmx_set_segment(vcpu, &seg, VCPU_SREG_TR); + memset(&seg, 0, sizeof(seg)); + seg.unusable = 1; + vmx_set_segment(vcpu, &seg, VCPU_SREG_LDTR); + kvm_set_dr(vcpu, 7, 0x400); vmcs_write64(GUEST_IA32_DEBUGCTL, 0); -- 2.31.1.498.g6c1eba8ee3d-goog