From patchwork Fri Apr 12 19:23:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuxuan Luo X-Patchwork-Id: 1923236 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VGRMN5hFyz1yYP for ; Sat, 13 Apr 2024 05:24:16 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rvMVP-0004ZV-1N; Fri, 12 Apr 2024 19:24:11 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rvMVO-0004XI-8s for kernel-team@lists.ubuntu.com; Fri, 12 Apr 2024 19:24:10 +0000 Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id C9F723F17B for ; Fri, 12 Apr 2024 19:24:09 +0000 (UTC) Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-69b62a06757so1639236d6.0 for ; Fri, 12 Apr 2024 12:24:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712949848; x=1713554648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v4Jf3blZWtliR9WXdOUl0BZ6IKfeaODHj/WSZLIzjrA=; b=j2TuI7BVdRFKpXsL+XHPCll0FqZQwbSIQ+N1j3bCU27RW8uP6jgDfeigUzwzL0gN7M Geo84QGwPsH53S/JtxDdnUFdpkHjH3d6Y79V1ghoAoMOi450GRJ/pC5U1FkdjBP5DrGI LbNoYHAr9S4OlJ9VlormKvsdWCLshwegRQsh/GKRDIqEKoKzeSCzNqapTYj2nyGcwFAj MG57hIPsKQ+6VF1c5kyDcSu4fP0tbOun1JptIlfX6KS36qxuySKmL1BwtTLGi8J+exv9 8NJRGcm4N5nlQEic7F5kbnkyJQFRfZMJOU+RkNklbpfePV3bUEfIf4rraxelxpVEVvnw btHA== X-Gm-Message-State: AOJu0YzyBKb2hSPUhT4m8yA4zvUiEL3vhIn4P8Y+MSdI72e85sG/1X5v m7jOpHCy6Y01NEczuR4VKTcywo4mSazDhDxUSh8YaTae4cAcirwTxoamICLBhI+PxWVWc82fZ/U nBY6YO0V5/UQkQmbcRQvm4Q34PWeuIHqmSA/AqJg7RsOCdqlsm7EDPArUGXNrUzkkREbXU5rFDj W9HNgnDE55EjDK X-Received: by 2002:ad4:504f:0:b0:699:2dca:fd4f with SMTP id m15-20020ad4504f000000b006992dcafd4fmr3832844qvq.47.1712949848399; Fri, 12 Apr 2024 12:24:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGN15kN8mWEWbRBueNj9MakJu5tt27qkJmTivUOhVPAfwNCQGECT4WGK/0ZrXwVeEsd5m3yCg== X-Received: by 2002:ad4:504f:0:b0:699:2dca:fd4f with SMTP id m15-20020ad4504f000000b006992dcafd4fmr3832831qvq.47.1712949848096; Fri, 12 Apr 2024 12:24:08 -0700 (PDT) Received: from cache-ubuntu.hsd1.nj.comcast.net ([2001:67c:1562:8007::aac:4795]) by smtp.gmail.com with ESMTPSA id z6-20020a0ce986000000b0069b47a53012sm2654071qvn.140.2024.04.12.12.24.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 12:24:07 -0700 (PDT) From: Yuxuan Luo To: kernel-team@lists.ubuntu.com Subject: [PATCH 11/13] KVM: x86: Add BHI_NO Date: Fri, 12 Apr 2024 15:23:48 -0400 Message-Id: <20240412192351.89501-12-yuxuan.luo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412192351.89501-1-yuxuan.luo@canonical.com> References: <20240412192351.89501-1-yuxuan.luo@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Daniel Sneddon Intel processors that aren't vulnerable to BHI will set MSR_IA32_ARCH_CAPABILITIES[BHI_NO] = 1;. Guests may use this BHI_NO bit to determine if they need to implement BHI mitigations or not. Allow this bit to be passed to the guests. Signed-off-by: Daniel Sneddon Signed-off-by: Pawan Gupta Signed-off-by: Daniel Sneddon Signed-off-by: Thomas Gleixner Reviewed-by: Alexandre Chartre Reviewed-by: Josh Poimboeuf (backported from commit ed2e8d49b54d677f3123668a21a57822d679651f) [yuxuan.luo: manually added the ARCH_CAP_BHI_NO flag to a new line] CVE-2024-2201 Signed-off-by: Yuxuan Luo --- arch/x86/kvm/x86.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 07c71892d5ae2..460ceae33ce05 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1498,7 +1498,8 @@ static unsigned int num_msr_based_features; ARCH_CAP_SKIP_VMENTRY_L1DFLUSH | ARCH_CAP_SSB_NO | ARCH_CAP_MDS_NO | \ ARCH_CAP_PSCHANGE_MC_NO | ARCH_CAP_TSX_CTRL_MSR | ARCH_CAP_TAA_NO | \ ARCH_CAP_SBDR_SSDP_NO | ARCH_CAP_FBSDP_NO | ARCH_CAP_PSDP_NO | \ - ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO) + ARCH_CAP_FB_CLEAR | ARCH_CAP_RRSBA | ARCH_CAP_PBRSB_NO | ARCH_CAP_GDS_NO | \ + ARCH_CAP_BHI_NO) static u64 kvm_get_arch_capabilities(void) {