From nobody Sun Feb 8 13:53:45 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 9E7D21A2560; Tue, 30 Jul 2024 14:15:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722348916; cv=none; b=nZ3M3i+OJYHChUOkKGzCKyCDX6joSR/EH8tcJnQbWt6yNhoJCSfLxiSn8lNpOffE4vIdhYfway12jgw1AVKDI/ssQl62oy4pv0L6Xp6wXy7R+GibywBV1wZIOo3nS7cEyfDE+100vYFurRjuMZeCo/xgPa2DM2BRNB6X/NZizoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722348916; c=relaxed/simple; bh=3ZxED3Hi0ZNzksdkP5fn97HoRckdlhvd7+g/xW/Q/9Y=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=jiCi8AWe2/LAv4BhaOIsgVvbi7XHuRCkLC/+Ohz7sMTQvMYfxmxQaKpy32ZVe7eFkklnhxGNeN4bzEn82qrcGPC0WFqjCoKk4u3HJYhZipPFiMMugz09mFY25xCruaN3t29MfPJg12Grb8fcgvnCPAoKLU+BJUUUIGeXdswYMyg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FYHna1tX; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OubjxVEA; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FYHna1tX"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OubjxVEA" Date: Tue, 30 Jul 2024 14:15:12 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1722348913; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tzrd3lzLDGqWUcvcaFgEvQme2caSlc2PkW95/QFzoTQ=; b=FYHna1tXQBdTvu7qdnMh5MYTdQmhsz4miJSAeyWxRiE6DcPedZtV57UVHZ9Ei6di3eyK72 LZVTlmEdMpxC/Oeb3VdZnxPdMZoqFyKrzCVF7TBHN2RMvY8fkxKMkStBo2BIjXkGkAN+Dr hFoPcA9itRHT9bR0vrt+DlAd2sZLOTHF/3oLlI36mXAe1k7nDmCv1mAxXn2wdpMUXYho5L 605N/Y+3anmLHxn0QeaAm4utZDBcMe7KsgnVwscuqbr/YZEpYk6fi17W4zf0mskTVPQrgn lNsf30cREGqzDrB8E1/AdgNMnO3AgYLS50oDRCBMEGdD3oZynBQlKuLXpS25SQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1722348913; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Tzrd3lzLDGqWUcvcaFgEvQme2caSlc2PkW95/QFzoTQ=; b=OubjxVEA+zAAC3LodLJz2KAMUh7hEzTa6m6yfAA5iVXdoDbndeR435vMtNib09UR/KjohW TU0GsxjY+ZMP+WDQ== From: "tip-bot2 for Breno Leitao" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/bugs] x86/bugs: Add a separate config for Spectre V2 Cc: Breno Leitao , "Borislav Petkov (AMD)" , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240729164105.554296-9-leitao@debian.org> References: <20240729164105.554296-9-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <172234891264.2215.9604724524846665240.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the x86/bugs branch of tip: Commit-ID: 72c70f480a70695523f984651d5da766b862c712 Gitweb: https://git.kernel.org/tip/72c70f480a70695523f984651d5da766b= 862c712 Author: Breno Leitao AuthorDate: Mon, 29 Jul 2024 09:40:56 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jul 2024 14:51:11 +02:00 x86/bugs: Add a separate config for Spectre V2 Currently, the CONFIG_SPECULATION_MITIGATIONS is halfway populated, where some mitigations have entries in Kconfig, and they could be modified, while others mitigations do not have Kconfig entries, and could not be controlled at build time. Create an entry for the Spectre V2 CPU mitigation under CONFIG_SPECULATION_MITIGATIONS. This allow users to enable or disable it at compilation time. Signed-off-by: Breno Leitao Signed-off-by: Borislav Petkov (AMD) Acked-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20240729164105.554296-9-leitao@debian.org --- arch/x86/Kconfig | 12 ++++++++++++ arch/x86/kernel/cpu/bugs.c | 9 +++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 22d3245..33e125a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2716,6 +2716,18 @@ config MITIGATION_SPECTRE_V1 memory access bounds check. See also =20 +config MITIGATION_SPECTRE_V2 + bool "Mitigate SPECTRE V2 hardware bug" + default y + help + Enable mitigation for Spectre V2 (Branch Target Injection). Spectre + V2 is a class of side channel attacks that takes advantage of + indirect branch predictors inside the processor. In Spectre variant 2 + attacks, the attacker can steer speculative indirect branches in the + victim to gadget code by poisoning the branch target buffer of a CPU + used for predicting indirect branch addresses. + See also + config MITIGATION_SRBDS bool "Mitigate Special Register Buffer Data Sampling (SRBDS) hardware bug" depends on CPU_SUP_INTEL diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 8292a96..45cbc6f 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1452,17 +1452,18 @@ static void __init spec_v2_print_cond(const char *r= eason, bool secure) =20 static enum spectre_v2_mitigation_cmd __init spectre_v2_parse_cmdline(void) { - enum spectre_v2_mitigation_cmd cmd =3D SPECTRE_V2_CMD_AUTO; + enum spectre_v2_mitigation_cmd cmd; char arg[20]; int ret, i; =20 + cmd =3D IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V2) ? SPECTRE_V2_CMD_AUTO := SPECTRE_V2_CMD_NONE; if (cmdline_find_option_bool(boot_command_line, "nospectre_v2") || cpu_mitigations_off()) return SPECTRE_V2_CMD_NONE; =20 ret =3D cmdline_find_option(boot_command_line, "spectre_v2", arg, sizeof(= arg)); if (ret < 0) - return SPECTRE_V2_CMD_AUTO; + return cmd; =20 for (i =3D 0; i < ARRAY_SIZE(mitigation_options); i++) { if (!match_option(arg, ret, mitigation_options[i].option)) @@ -1472,8 +1473,8 @@ static enum spectre_v2_mitigation_cmd __init spectre_= v2_parse_cmdline(void) } =20 if (i >=3D ARRAY_SIZE(mitigation_options)) { - pr_err("unknown option (%s). Switching to AUTO select\n", arg); - return SPECTRE_V2_CMD_AUTO; + pr_err("unknown option (%s). Switching to default mode\n", arg); + return cmd; } =20 if ((cmd =3D=3D SPECTRE_V2_CMD_RETPOLINE ||