From patchwork Fri May 17 07:57:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuxuan Luo X-Patchwork-Id: 1936310 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 4VgfV24Yy1z20dg for ; Fri, 17 May 2024 17:58:34 +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 1s7sU1-0006Jo-E8; Fri, 17 May 2024 07:58:29 +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 1s7sTy-00068Y-Uw for kernel-team@lists.ubuntu.com; Fri, 17 May 2024 07:58:26 +0000 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (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 CB5DA3F366 for ; Fri, 17 May 2024 07:58:25 +0000 (UTC) Received: by mail-ej1-f72.google.com with SMTP id a640c23a62f3a-a59fbf2bacaso604301266b.0 for ; Fri, 17 May 2024 00:58:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715932704; x=1716537504; 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=8ljI7C9MadZt5CbgREdK0iJtrFGsR8wlStfxO0jEiKs=; b=jh+BBRc5sXLiMnSiQXC45jQU6QedxgYCD04RKgab7Rm5vquy7WLLQ41+w+gm4Fy7ak Hv1JQxCi8PKxIH7Wre9aGGbryYVddQHu3V/Oy6grrjYvbe6lqGY7anv0fu/+UTvH6pnK wqGCg76GjAFVMKdGgw3SMjJ/kqSwIZb1X4xK3mzcEq8UPKWCLffnfTntefbI0R29pTn3 Whd5PYOqwbiDJrq8t9NbR8AlaNE51DWOFDXVdaKtgabDTRRw/3UkhmtDro6o1qn8IsJr kIWMw4zglyKKmjNAZnPHaAoFCXfALd6x5JUHU1VrRPGvH/9cupC7nmxlYKQXgtTFFnHy nUlQ== X-Gm-Message-State: AOJu0YwuXcy6chN7bHoF1jVdf0W8+Ck6EmRdcAi/qEwxgeje+/RyS/TI Vv65GxpaHPEx52l+b3EtebEX6hh3g0swlEEP9wG2x0Nh7hg3FMocB6GrB+GMocvXBa9CuIN50Xe 6HbbTD4nRLMyniumZV2x96ki8HgYC84L/rdoZS804ICXD4XnFDry/4GgJn96ONmTfAIhSoDImYa Lww0bk22FrD/9i X-Received: by 2002:a17:907:12cb:b0:a5a:893a:a73a with SMTP id a640c23a62f3a-a5a893aa833mr906961566b.10.1715932703918; Fri, 17 May 2024 00:58:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEThklmHglcdEZFiWGzy/pp7GhgBUS2FPUpPQBX8bVq2f/71Ol/PQma91VNg3Y+4qHpM4p7nA== X-Received: by 2002:a17:907:12cb:b0:a5a:893a:a73a with SMTP id a640c23a62f3a-a5a893aa833mr906959266b.10.1715932703609; Fri, 17 May 2024 00:58:23 -0700 (PDT) Received: from localhost.localdomain ([2001:67c:1562:8007::aac:4795]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a17b179f1sm1080016966b.212.2024.05.17.00.58.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 00:58:23 -0700 (PDT) From: Yuxuan Luo To: kernel-team@lists.ubuntu.com Subject: [PATCH 14/15] x86/bugs: Clarify that syscall hardening isn't a BHI mitigation Date: Fri, 17 May 2024 03:57:27 -0400 Message-Id: <20240517075728.9722-15-yuxuan.luo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240517075728.9722-1-yuxuan.luo@canonical.com> References: <20240517075728.9722-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: Josh Poimboeuf While syscall hardening helps prevent some BHI attacks, there's still other low-hanging fruit remaining. Don't classify it as a mitigation and make it clear that the system may still be vulnerable if it doesn't have a HW or SW mitigation enabled. Fixes: ec9404e40e8f ("x86/bhi: Add BHI mitigation knob") Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Cc: Linus Torvalds Cc: Sean Christopherson Link: https://lore.kernel.org/r/b5951dae3fdee7f1520d5136a27be3bdfe95f88b.1712813475.git.jpoimboe@kernel.org (cherry picked from commit 5f882f3b0a8bf0788d5a0ee44b1191de5319bb8a) CVE-2024-2201 Signed-off-by: Yuxuan Luo --- Documentation/admin-guide/hw-vuln/spectre.rst | 11 +++++------ Documentation/admin-guide/kernel-parameters.txt | 3 +-- arch/x86/kernel/cpu/bugs.c | 6 +++--- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Documentation/admin-guide/hw-vuln/spectre.rst b/Documentation/admin-guide/hw-vuln/spectre.rst index fe50e9cb00282..601be75541bf2 100644 --- a/Documentation/admin-guide/hw-vuln/spectre.rst +++ b/Documentation/admin-guide/hw-vuln/spectre.rst @@ -441,10 +441,10 @@ The possible values in this file are: - System is protected by BHI_DIS_S * - BHI: SW loop, KVM SW loop - System is protected by software clearing sequence - * - BHI: Syscall hardening - - Syscalls are hardened against BHI - * - BHI: Syscall hardening, KVM: SW loop - - System is protected from userspace attacks by syscall hardening; KVM is protected by software clearing sequence + * - BHI: Vulnerable + - System is vulnerable to BHI + * - BHI: Vulnerable, KVM: SW loop + - System is vulnerable; KVM is protected by software clearing sequence Full mitigation might require a microcode update from the CPU vendor. When the necessary microcode is not available, the kernel will @@ -703,8 +703,7 @@ For user space mitigation: spectre_bhi= [X86] Control mitigation of Branch History Injection - (BHI) vulnerability. Syscalls are hardened against BHI - regardless of this setting. This setting affects the deployment + (BHI) vulnerability. This setting affects the deployment of the HW BHI control and the SW BHB clearing sequence. on diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index bccf22d167622..59714ce57f3b1 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4607,8 +4607,7 @@ See Documentation/admin-guide/laptops/sonypi.rst spectre_bhi= [X86] Control mitigation of Branch History Injection - (BHI) vulnerability. Syscalls are hardened against BHI - reglardless of this setting. This setting affects the + (BHI) vulnerability. This setting affects the deployment of the HW BHI control and the SW BHB clearing sequence. diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 4cdf99c1feafd..fe27ebe95030a 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -2356,10 +2356,10 @@ static const char * const spectre_bhi_state(void) return "; BHI: SW loop, KVM: SW loop"; else if (boot_cpu_has(X86_FEATURE_RETPOLINE) && rrsba_disabled) return "; BHI: Retpoline"; - else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT)) - return "; BHI: Syscall hardening, KVM: SW loop"; + else if (boot_cpu_has(X86_FEATURE_CLEAR_BHB_LOOP_ON_VMEXIT)) + return "; BHI: Vulnerable, KVM: SW loop"; - return "; BHI: Vulnerable (Syscall hardening enabled)"; + return "; BHI: Vulnerable"; } static ssize_t spectre_v2_show_state(char *buf)