Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp13819911rwl; Wed, 4 Jan 2023 13:39:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXverCEAg4RdBXcOyelsOMLxmjcu8VtmLWalW0taQTTl7syZXXrlLoflElpR29xmTBMumWFJ X-Received: by 2002:a17:90a:ea0a:b0:219:211f:e2ae with SMTP id w10-20020a17090aea0a00b00219211fe2aemr50754366pjy.49.1672868372656; Wed, 04 Jan 2023 13:39:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672868372; cv=none; d=google.com; s=arc-20160816; b=zaFsoZK+hx2lsyzXRcORX9nEkm9336k/JIbXoGvAEX5ldnvzasfSNS1SgP1tGIioxd KENBFGEOukFfY7jZ1p8rlkt0Xz2L0g4+P/b/lacG2myI+DPtlZJlm4GGG8SGHsw7XYCG ONrFvEUyYTzj39h5aZdHmq+mBXKol6LV/usAKM/vORMk7OCotmvqe63JMKOU4XdNqqAn IHZMGIxqrH/lMVIC8MNHMT35K96dmg5rjii40RsBK+AXeqC+36F4/IrU3ovLV7e0jk0l y4a5UoM8O2sCc9UOLaPuDsEePfRMjab/xmEuCZ9ghVJNdgsJLUvKHPGalVcm2dmDrILG qSoA== 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:message-id:mime-version :in-reply-to:date:dkim-signature; bh=9Tq7FtjdAxMenZUdP94jpiY1WQWtFexBAUHIvWXe5/E=; b=R4x4AnHk3a0fUIUJavfGK9cmztCrDDeFI/rg2JkXYmeKTB9erYJ2it14QpRV4JTn7U fcB05kxjmQiC5bLz8BI+lNPpmumfUxINnG7AKEI2e5L8E1DXw02QVsAiJdbw6S5QruGD zeax0DVV+Tqt2ISpX8B0yGWH6YNLxfdRs4O9uqM/qO7trIpQQokjw/rdotAm8wNLTpVA CBm/vib71kxryw8lv+P+qNKKsZFss0gkpdIvCDNx0Vh7zKRVJrjXYxa6A2CBKuCk3YF9 WJop/66OBlpJ/kBNPh05LgLYBwoCy51EgImssNsU5BB8Isoa52RKJbS+cTaJzJn/NSg6 N3ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rhMJnL5K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pi12-20020a17090b1e4c00b0020af2411705si44885pjb.104.2023.01.04.13.39.25; Wed, 04 Jan 2023 13:39:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=rhMJnL5K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S240410AbjADV1H (ORCPT + 58 others); Wed, 4 Jan 2023 16:27:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239423AbjADV0t (ORCPT ); Wed, 4 Jan 2023 16:26:49 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDC5443C23 for ; Wed, 4 Jan 2023 13:20:39 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id b14-20020a170903228e00b00192a8ae9df5so10727341plh.7 for ; Wed, 04 Jan 2023 13:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:mime-version:in-reply-to:date:from:to :cc:subject:date:message-id:reply-to; bh=9Tq7FtjdAxMenZUdP94jpiY1WQWtFexBAUHIvWXe5/E=; b=rhMJnL5Kf2ZkCYhp3cK7TEhpRX5YMA+GtsfOOIzbLggq6rTracB5eJx9MQdqkYxe7e eWtu0sMivWTwYWdxQFeBdPgyWfqnVbfvWFNK/eEEffjHrcxg0a34bg0jOuEvv6DC2jlF osfjOEOcWnv4olDRNPZEXB/95n3/lJ3b/Q0mvhQn4CcHuQsD3ECZOglQoirZar7eerZK 9pB3UCmCj6CGjh1dMNPSIeq+fIqGUsEkMAFBuv39udy4xCmk7EVtMfnP8HzYV3NbaOhc /8GgMYDt1PxTHijgHXP9IOWQWjcl3FERTxE7FxEjU+ApJ9iYGHC9xwuKPPt1OSP6uKiD qYGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9Tq7FtjdAxMenZUdP94jpiY1WQWtFexBAUHIvWXe5/E=; b=1fURMR1KouHsQO8j1XmlxB1kzpad5V7DjymksewdUoE5XoLyVBfp9ulOyoATcOFZFz iwoKNx5B7/noc/32pEYQwLJer3HB+N5uuRYEa7R2epegeYHyU4poXVogLPamILpyubeJ MPuuuOpfgKthoBV5NhdVFL73ZJEpXKO7FNQ35v5h5SeqdfJLMKuP0/mjWMrP2PgVQ1S2 uRlnKhymlHXPmv4jKyCMgrgtgt08p0Bs9CjiVcWFsyFI2pUnRTF6VNDX7oKhGMF/1HoQ UJni3px/9I6olMANQAKJzLX+UeOPIlqr0VCwMy/pl0sZHlQuCDuc+EdoM8LtOeOXiRMb E3iA== X-Gm-Message-State: AFqh2krDKWkUVwaABJhPm3if6Bz6Y6+RISnyLuKtfg+vx/FYQi+Bm5TA eK+I6bLrH37r8zSIIYvtKjBSnFCSEie2s2DNnw== X-Received: from ackerleytng-cloudtop.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:1f5f]) (user=ackerleytng job=sendgmr) by 2002:a17:902:bb8f:b0:192:fa87:f109 with SMTP id m15-20020a170902bb8f00b00192fa87f109mr88333pls.173.1672867215663; Wed, 04 Jan 2023 13:20:15 -0800 (PST) Date: Wed, 04 Jan 2023 13:20:13 -0800 In-Reply-To: <1cacbda18e3c7dcccd92a7390b0ca7f4ba073f85.1667110240.git.isaku.yamahata@intel.com> Mime-Version: 1.0 Message-ID: Subject: Re: [PATCH v10 098/108] KVM: TDX: Implement callbacks for MSR operations for TDX From: Ackerley Tng To: isaku.yamahata@intel.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, isaku.yamahata@intel.com, isaku.yamahata@gmail.com, pbonzini@redhat.com, erdemaktas@google.com, seanjc@google.com, sagis@google.com, dmatlack@google.com Content-Type: text/plain; charset="UTF-8"; format=flowed; delsp=yes X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham 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 I believe we should also have a handler for .msr_filter_changed. Without an .msr_filter_changed handler, a host crash can occur if we first set up a vcpu for the TD, and then set an MSR filter. If we first set up a vcpu for the TD, and then set an MSR filter, upon vcpu_enter_guest, the .msr_filter_changed handler (currently vmx_msr_filter_changed()) will be invoked. to_vmx(vcpu) interprets the containing struct of struct kvm_vcpu to be a struct vcpu_vmx instead of a struct vcpu_tdx. In my case, I was working on a selftest and the missing handler caused a NULL dereference in vmx_disable_intercept_for_msr() because vmx->vmcs01.msr_bitmap is NULL.