Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp3085691lqt; Tue, 23 Apr 2024 09:53:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXPZZd+bP2oG1gQflL+DIpY+NaCaLC3NIGQhfqGFZjgQkFTAT9QZ6GdDG5EIWi12DzCoPj0r9R+H1mSuPBQeX5jqp+TqI2keP+UYaTEkA== X-Google-Smtp-Source: AGHT+IGe19WwCk6xscWcHa2NBzbTmfwT/alJ+XUoneLctBBr0TeFs1JxFIvnQtiKqoIX+ccGJ1oF X-Received: by 2002:ad4:5d6b:0:b0:69b:7143:c58a with SMTP id fn11-20020ad45d6b000000b0069b7143c58amr6034718qvb.26.1713891221607; Tue, 23 Apr 2024 09:53:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713891221; cv=pass; d=google.com; s=arc-20160816; b=oEE4hqsI7zri9aaC3CKxMcdl7ARJviVor6x70RTYTd9+TtASdXGxRj+OsewYZpRUFR MbU1XUwevex+/fCSYda2mcI0X49w9s4iP6c/3ncybFVDpr8KsOg9m1MSIyfo/QNbHMii l44nBgMjUfYeVULrnygXGIQNDhMH2gR253YgR68YvfzBWav3tGAy2hU7qsH1g3WRbT6P 7xSQMNKnqqd6gRTh1zLL+nC13TXQVmkq+VAEVAun86MkbwAz+uGQxOsi/XBmkglYKCGk Dn157g/6GVNL2jh/iQCb1dSSHJ/OJ0NuevsDanrgCQpCMngJElLm2LQxwbTQXg7illo+ GTag== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:reply-to:dkim-signature; bh=qrP9nBCRHnbapRwTWmq1c8aapUPVM5pIy3QZe5z3ugg=; fh=ckEsK3aPOCG8WKmsBkq9LuOE4thAU3syuzD5VKdH/04=; b=xjKfMz2jDrKbAxAygL+Jla3nfXaGT6DAZ/GEEy+XnNSpVTDun/6HraVGdz/yOA3Isi /BzPCatDXCTjwFjH6bhnKC+QcGpouz6K5yu20jrFMyCQaF7mJzn9csgZ2A8Tzq1wh+TA UH+HKr7a9L2ifpEvZbjEHqF7erouV0rVMaq5UyCd4vBPePIBdTuUuAgQwOobPKqhiy4k wJoktICEBjc+eOU6E1IImwXHIyAysI6ryQ/QR7dKrUlp8kwqbo3i4t0RgYPtMJAEAUar FMzkAuZlAaGW8GuC0N7pFWxJNm2hvSIHGPbA7FYdAaAWi1DN6M4nDpncAb8v/YSkYzfu YbjQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Cb9+jKNs; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-155598-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155598-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id kc13-20020a056214410d00b0069b1a86e181si13015051qvb.113.2024.04.23.09.53.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 09:53:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155598-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Cb9+jKNs; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-155598-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155598-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 46E011C228F5 for ; Tue, 23 Apr 2024 16:53:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48D3113D63C; Tue, 23 Apr 2024 16:53:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Cb9+jKNs" Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 450241332AC for ; Tue, 23 Apr 2024 16:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713891212; cv=none; b=WMRhULLAZGsc7X+pPGJ4bIHKJlNlBsFsbBmz9P+yOpC1vOpj3jPzl3LiCelx3qpAZanQPZ1zzJ5tvAxZok+i1fXHCkUzXEqhvnbQq4EwkSEXRtX+jqr2Ddz+HrLTDlc7G1A94ub6DH9jlwpcc0j251mVFFznZ103SY5l1ZbB9Kg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713891212; c=relaxed/simple; bh=VV2P3DvxsTFjbP6O9idsUsljoX1RNExhaHDA1IIjccY=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=k9BDafdetH9rabGIVqF7LWYkW46paeXzbtfeYN8eNPzTEdtW4amtYcX1x2TcUUgx5mnjJ1zpEwQM7wEfgl70ENsdI05gxA2fcO5zHVikV2nmGmSAZ9F7w/m3my6PdNVzJ3lxjtmg82JHvvoIc+b89FZ4ZfagELpZI+Dd6fEI3w0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Cb9+jKNs; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-6ecea48eb37so7065041b3a.1 for ; Tue, 23 Apr 2024 09:53:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713891210; x=1714496010; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:reply-to:from:to:cc :subject:date:message-id:reply-to; bh=qrP9nBCRHnbapRwTWmq1c8aapUPVM5pIy3QZe5z3ugg=; b=Cb9+jKNsK/7uYGpt+bl4m2uUHIIehpIOkNhKS3LfWp006LLDP8Xe7hE+T9i/qNxsMK ntgkfVx5d62egu7OazFNsMQPOPhqaJ+INttM7u1iUFcmfyGp7Ffk0wvyN21R1NICk0HZ s41Gcrm1q1dekKRTMMmVsIVEVhWpkXgYNnNQaCe7ROfraVStY2mIpieILAOpQoTM7gol yFfsfEe4Jc5TwgCVKdL/Fh0eXT27wDQ170F9cGc9o/CoVJ/qDa2ozvtUzmbRYVkupNH1 wETKUFYucKlHoihJPPtf0VcanoTfDgh/Uo7404OyC7Z4bP1AzAyo0+X1zDWeZYTb7Vs/ KUug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713891210; x=1714496010; h=cc:to:from:subject:message-id:mime-version:date:reply-to :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qrP9nBCRHnbapRwTWmq1c8aapUPVM5pIy3QZe5z3ugg=; b=NWUIhy73PiMBM7BCX/m3MFEW71w3YeDFQVWZdM5lfJ53ES+HU4Rb/bz47FZGHdbEBE TSXkIiS6zLBgr9PrmCl1VwOa9G/vO34qoIyp5YMhpaLvBjgC1rVFS//tBye6t265Ins+ y0AfZweaf4iVflpsYxF+ruKBcYGrtbjPdFPgiUUK4c11PcZO/gBuZZh92PBdAWKJB92s cGhqzBv2jeLnnEFewuaMnAE89t4O8GixIM/hqFXlr7SQ3antVwSeZEbNWYPkCANZ9PDm vmXGjqwTN4JH6FanesUpiQeFEfgwfwglabtWzrW2Oja+98ukY4rp+GYjhe7Dh0QdUStg OkJg== X-Forwarded-Encrypted: i=1; AJvYcCVQewrk3Hp7qRJhAqs4Wvlqnpuxpofs5Sswx2zDt7wqzK1YyuJWqOC/ysWWuTt4TpiQMkP6N4CloF9w+nkTe37ffsSG4+kfQAOwDuH5 X-Gm-Message-State: AOJu0YxxOiWJ7uPfPumkJIBi5noq9etUA15TY0CTab9gVqlZlNEbkYNL lmXD18XWZgKg3IQutt29VPOf+4FxCJgxPauaHvE3yhQXWXvtLFvIuW/ZZG1YGsFZb5OhZDKVx75 AfA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:1888:b0:6ea:ad01:358f with SMTP id x8-20020a056a00188800b006eaad01358fmr888pfh.6.1713891210464; Tue, 23 Apr 2024 09:53:30 -0700 (PDT) Reply-To: Sean Christopherson Date: Tue, 23 Apr 2024 09:53:25 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog Message-ID: <20240423165328.2853870-1-seanjc@google.com> Subject: [PATCH 0/3] KVM: x86: Fix supported VM_TYPES caps From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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. 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 -- 2.44.0.769.g3c40516874-goog