From nobody Sun Feb 8 13:45:35 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 E7B5020E6E2; Mon, 3 Mar 2025 12:11:04 +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=1741003867; cv=none; b=Xq9XOUu0cq2txIsVn3kdqbHjdt2YT2BsWNuQPQbh9pnYDJHHQwiD4zsiTwfiDxt1H4xZI4uEop1VOQBe54Z4HFUf4ii+TVOAg15jbLngQ8CqwLiP2LbiktCatHy5doJF9giMgo89FBullx2Fjt3lLpiN/bFLXPV0u1PHA7p4KH8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741003867; c=relaxed/simple; bh=svQsuqvzeMABmYhAHLDMNTSCvoheTvuxeLM+VbPPpew=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=iJRWL5LBfjpY5eWf/XbK5c6du/fYBk/CzS0CazFqmGlaRYQC3sHf9K3Q2DN6o+Hrlzqt8XxQpMpp/gWThCWaNjc0qZwzhRQJhcnzqZuh3S8MmrQo90Y1mKzX76akNkiag9j/kbok/dQu5Ikfap32aM259ykwxVkV4O2/0F4NqWY= 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=2TUodsjn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wIxtRb2H; 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="2TUodsjn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wIxtRb2H" Date: Mon, 03 Mar 2025 12:11:01 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1741003862; 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=BgVdqIxVtV58B5lqYfeHWLWWTg0ElzpE/QlzEqveNw0=; b=2TUodsjnXtS8YlZbxVLWb7FbwGEhlY7EBGsQr12viXOICA7rJ9ynUgAVWUdtTHc7NPwUp7 3Ct1IMGgddmQSB7CNOX8RDnO/FFz+FeSVm6QyBLO+ohwGWRF31bFDRXJY82X6TZCypAIzy Yh8w3v/W6BYWpk+KSpf8eekbK+xSNaJB9opGhKH7SOrQN6fSYgc/ZNH3/faaXBtWm5rZg1 ncc6Hboxt9ojBq6RatUmX9qtK/WRnjeJ7/2+xldF6qI7P12apy+PbOydqQBj1mIsCMTLSe 99GVVHfZMhwZV41Enzphz21gDw51XH4rQs02SVVrcQCOHuHD2rUgTbNxD1mE+g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1741003862; 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=BgVdqIxVtV58B5lqYfeHWLWWTg0ElzpE/QlzEqveNw0=; b=wIxtRb2Hg+tfXM1TFMwzFuXdvUx6iEaOyBCnq6MIrS+a316yxTrryODg8Ldg+Dp+DPhcea YHP5essQUnS74iDQ== 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: Make spectre user default depend on MITIGATION_SPECTRE_V2 Cc: Breno Leitao , Ingo Molnar , Pawan Gupta , Josh Poimboeuf , Peter Zijlstra , David Kaplan , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20241031-x86_bugs_last_v2-v2-2-b7ff1dab840e@debian.org> References: <20241031-x86_bugs_last_v2-v2-2-b7ff1dab840e@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174100386189.10177.5924997296106103360.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: 98fdaeb296f51ef08e727a7cc72e5b5c864c4f4d Gitweb: https://git.kernel.org/tip/98fdaeb296f51ef08e727a7cc72e5b5c8= 64c4f4d Author: Breno Leitao AuthorDate: Thu, 31 Oct 2024 04:06:17 -07:00 Committer: Ingo Molnar CommitterDate: Mon, 03 Mar 2025 12:48:41 +01:00 x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2 Change the default value of spectre v2 in user mode to respect the CONFIG_MITIGATION_SPECTRE_V2 config option. Currently, user mode spectre v2 is set to auto (SPECTRE_V2_USER_CMD_AUTO) by default, even if CONFIG_MITIGATION_SPECTRE_V2 is disabled. Set the spectre_v2 value to auto (SPECTRE_V2_USER_CMD_AUTO) if the Spectre v2 config (CONFIG_MITIGATION_SPECTRE_V2) is enabled, otherwise set the value to none (SPECTRE_V2_USER_CMD_NONE). Important to say the command line argument "spectre_v2_user" overwrites the default value in both cases. When CONFIG_MITIGATION_SPECTRE_V2 is not set, users have the flexibility to opt-in for specific mitigations independently. In this scenario, setting spectre_v2=3D will not enable spectre_v2_user=3D, and command line options spectre_v2_user and spectre_v2 are independent when CONFIG_MITIGATION_SPECTRE_V2=3Dn. Signed-off-by: Breno Leitao Signed-off-by: Ingo Molnar Reviewed-by: Pawan Gupta Acked-by: Josh Poimboeuf Cc: Peter Zijlstra Cc: David Kaplan Link: https://lore.kernel.org/r/20241031-x86_bugs_last_v2-v2-2-b7ff1dab840e= @debian.org --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ arch/x86/kernel/cpu/bugs.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt index fb8752b..274b71a 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -6582,6 +6582,8 @@ =20 Selecting 'on' will also enable the mitigation against user space to user space task attacks. + Selecting specific mitigation does not force enable + user mitigations. =20 Selecting 'off' will disable both the kernel and the user space protections. diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c index 346bebf..4386aa6 100644 --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -1308,9 +1308,13 @@ static __ro_after_init enum spectre_v2_mitigation_cm= d spectre_v2_cmd; static enum spectre_v2_user_cmd __init spectre_v2_parse_user_cmdline(void) { + enum spectre_v2_user_cmd mode; char arg[20]; int ret, i; =20 + mode =3D IS_ENABLED(CONFIG_MITIGATION_SPECTRE_V2) ? + SPECTRE_V2_USER_CMD_AUTO : SPECTRE_V2_USER_CMD_NONE; + switch (spectre_v2_cmd) { case SPECTRE_V2_CMD_NONE: return SPECTRE_V2_USER_CMD_NONE; @@ -1323,7 +1327,7 @@ spectre_v2_parse_user_cmdline(void) ret =3D cmdline_find_option(boot_command_line, "spectre_v2_user", arg, sizeof(arg)); if (ret < 0) - return SPECTRE_V2_USER_CMD_AUTO; + return mode; =20 for (i =3D 0; i < ARRAY_SIZE(v2_user_options); i++) { if (match_option(arg, ret, v2_user_options[i].option)) { @@ -1333,8 +1337,8 @@ spectre_v2_parse_user_cmdline(void) } } =20 - pr_err("Unknown user space protection option (%s). Switching to AUTO sele= ct\n", arg); - return SPECTRE_V2_USER_CMD_AUTO; + pr_err("Unknown user space protection option (%s). Switching to default\n= ", arg); + return mode; } =20 static inline bool spectre_v2_in_ibrs_mode(enum spectre_v2_mitigation mode)