Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp1132192lqd; Thu, 25 Apr 2024 07:00:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXsRje1Hwj1O7CTcKuknxFNcVMeyTogDokOqQpOsUW39V2G3dSUBlOWsKO7FgU8NKEcWG/tP3yDim6apRDisqNXLQtWMstYpuw4iuDWFQ== X-Google-Smtp-Source: AGHT+IHimsn3ELnV4pSKrNWEiagT4git8lfB1/COJ7bxKr/Mbt8sSWAbULnTxZdeqlfyZu7UmytX X-Received: by 2002:a17:90a:e7c3:b0:2af:3bce:6e4c with SMTP id kb3-20020a17090ae7c300b002af3bce6e4cmr5153526pjb.16.1714053635341; Thu, 25 Apr 2024 07:00:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714053635; cv=pass; d=google.com; s=arc-20160816; b=KSZsj67ackbhOqnyoHWMK6g2bZdmRdJ2pPgyvIA4bQA69YQcT0YalK2Saw0O6KuQrR KjV2t7PM3Axq33o7UkVaGS6q1byDxWYhSf4XlA6O2WsorEu19E17zqvNGRGdjK8rJ1nu Z/QMl+hpjucX3cFpbiGVq+oL0ytNnAfQgF9Ggg2ATaOwxwG8kk5ktA6AHu0fIR74Nt6z ycAzoI/HwU3z+ALw9p7eN29FhirNWrAf2H0BJlp2eToy5WLuOQSxIdG9OVKGknli5HLL FrYZZe3KeRoRo6DiF2IFaPbxiZq20QfGXbTstEgr8FDsBNQzvDMPK0rXHBiZt3wiirBv xOcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=KelAjmyYfKETbVNYqv3mpW1O2rJ88ybqxJia6+0dQxA=; fh=a/B0iV5LWklS7QUR0cRnqbJdAtXzyhd2Xbve3+VFDMU=; b=wzu9JrmwqqHN2ISsEXI5Krd9yuWQ+IkMWBKaMB/G2+VQkkuVwepOerT0yEL7Id0BsJ iZbm7+NzSyLw5SdAndkXtYpcqfE+BIeTf688/XArIy4hQ0pJYsbMdgzUgmrkm6NbqIBQ rG22cN53Razw3Onkmy/6+djpPxMisvrGbkoSDrQ9bGLHOIVp2YlZEhd/68lDZxuDCPZc Ry0ACt54QSj6yDISL+eND/YrHLQiZ8KZYgM55KTgDQCJR3fUqgv1LYU+xvdB7agjIA1L W6bxvKPHByXZpq1d7eDevVjv16PeXVbstm6jU5GJZUvliUJxkUQhldcJrCdDQEVH5w5W Is2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L0B7K8yx; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-158616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c6-20020a17090aa60600b002a66c1dca70si13207998pjq.66.2024.04.25.07.00.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Apr 2024 07:00:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-158616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L0B7K8yx; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-158616-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-158616-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 4784CB22B5C for ; Thu, 25 Apr 2024 13:43:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D07A149DE9; Thu, 25 Apr 2024 13:43:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="L0B7K8yx" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9850F149C4D; Thu, 25 Apr 2024 13:43:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714052607; cv=none; b=lzwJnALsNZjNaZmFid+N1FTAVlIDGEwWhu4kxyYN1rzs5dhUurRdlj45I/LW9M1yzIj0zeWrgshmyADstz3115kNJun32AGwyGz3YsQRbJBHIpeflMyM76KWkXBw+4G61Him8uKWJbRuejEmth4ee/DLVZEvPVfmwFi1TgXtcbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714052607; c=relaxed/simple; bh=NPSlzCKVCsU2wq+izhAa1CU8nylnb03JghGzrs0lLp8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=T4rXTEka3DjwPBhpuB8Ml6VIDG0wHNsqWWOiggNIilXfRwtYX5jccGut4bji+UinQQcK2yzbB0hnmgMkevWk0ydYby1EzgN3js3jbVB8lykznTcyUnlj0oejgiAB3p18kyfrgfr7qXrH7q4BNKDr16VICJWs9goeX5O2k7Yu5kU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=L0B7K8yx; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714052605; x=1745588605; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=NPSlzCKVCsU2wq+izhAa1CU8nylnb03JghGzrs0lLp8=; b=L0B7K8yxUkCPx3o+0k5xVcK15sWTjxHaBhpu1MYcrXMtDSRmXRcyWPQe V2zDgG46Zy+tDu6uZGANJC8vVJJtt4qx3IOebcgc5hHlfmANKJLowgbR/ HBM/WtXq85EjBnKBs8/1E5hcFCQ29zwfeXxG5OnZ7JyD+Ad/azBoMrnkx 0SH7c0QXZTTM82vupZcOjJOXCyszo10U6hf7CXZqllsZBvhj68+saJDYp lL9coC2WqOzlkSJ8ojEFOmP2goLebck6Su4BDDd5tSSqQL9n6MBJy4gsb 1mFx/l1DPgp7Y/HuMCI23WHYvixDhekaB4zP4ueAcPW7bGLWDHyHcwVeJ w==; X-CSE-ConnectionGUID: yMdGrwlVSSOWcesWQ+zPBA== X-CSE-MsgGUID: ILZLXdEzSd+rXYP14MkZnQ== X-IronPort-AV: E=McAfee;i="6600,9927,11054"; a="20352405" X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="20352405" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 06:43:25 -0700 X-CSE-ConnectionGUID: YFV6ZcPxRf6rFe4wTzZqQA== X-CSE-MsgGUID: 6TzPwLkDQ9aQD+iZ9E0nzQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,229,1708416000"; d="scan'208";a="25143068" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.124.242.48]) ([10.124.242.48]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Apr 2024 06:43:22 -0700 Message-ID: <4a66f882-12bf-4a07-a80a-a1600e89a103@intel.com> Date: Thu, 25 Apr 2024 21:43:20 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/3] KVM: x86: Fix supported VM_TYPES caps To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240423165328.2853870-1-seanjc@google.com> Content-Language: en-US From: Xiaoyao Li In-Reply-To: <20240423165328.2853870-1-seanjc@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/24/2024 12:53 AM, Sean Christopherson wrote: > Fix a goof where KVM fails to re-initialize the set of supported VM types, > resulting in KVM overreporting the set of supported types when a vendor > module is reloaded with incompatible settings. E.g. unload kvm-intel.ko, > reload with ept=0, and KVM will incorrectly treat SW_PROTECTED_VM as > supported. Hah, this reminds me of the bug of msrs_to_save[] and etc. 7a5ee6edb42e ("KVM: X86: Fix initialization of MSR lists") The series looks good to me. With v2 to move the reset of kvm_cap and set the hardcoded caps earlier, Reviewed-by: Xiaoyao Li > Fix a similar long-standing bug with supported_mce_cap that is much less > benign, and then harden against us making the same mistake in the future. > > Sean Christopherson (3): > KVM: x86: Fully re-initialize supported_vm_types on vendor module load > KVM: x86: Fully re-initialize supported_mce_cap on vendor module load > KVM: x86: Explicitly zero kvm_caps during vendor module load > > arch/x86/kvm/x86.c | 15 +++++++++++---- > 1 file changed, 11 insertions(+), 4 deletions(-) > > > base-commit: a96cb3bf390eebfead5fc7a2092f8452a7997d1b