From nobody Wed Apr 1 19:58:05 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 215341FDE2B; Tue, 4 Mar 2025 08:27:54 +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=1741076877; cv=none; b=BWjTV4baT7ZStPKIZsns8jm+buNI1cutODob5YVRJXghf0I/L1tGcX2F5xYdj/J2r7IlKmapiihVOOsool4SkTuZE8cuD6v1G1MOH8y/7qgGWGumCeo2ft1jDN9LK4mKlOpvZTeeqKeHzuMrzNMa5lxyCzkIaMnmzIAACgm55fs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741076877; c=relaxed/simple; bh=UXK34iZcqNzOHgTgkxnA9XSM43n+N2SNFGr56lakNzM=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=UZk7/3qGD+VhTKtP0S1iF4zuD3Py6rVKfQp3ptqbar4T8Hbuo9Sa9M7B0F7BoQiW6CDXRqedIWOlMLvRSQfTDUD1Y1oFIVIpI4yfDzLr/EJWkWvzZ6A5zz8i9iW3+tb634mRdSYOBKvJS49QC0GKM0rmDvW46XxbcoCQUk8ANiM= 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=HEqMS7Ms; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=7VcAwdDz; 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="HEqMS7Ms"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="7VcAwdDz" Date: Tue, 04 Mar 2025 08:27:52 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1741076873; 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=dMGDQZu5FA95BFqikIlJ7YWTqVrXpl8bK0mGP7UazmU=; b=HEqMS7MsLNxIizOvRKD8ZoPQUPM9Yf0OoZRPjFNgIpB9gxTuqBg8UPbhRyVPEq4rVTcBc4 cCM8YnatJYNorBDvqFrbSY9N7Jej0RZX2W7IKUBDjts5KqJdbj+M//Qq4FBOI2SvqCM0YI D1SmE7NnloVAyBD5lntfoCy1j0vyso8SKiayqShNbEglY8OPmZrP3bHj+zODGWox6E/eYC iBWjC+gnqB62tWNvlf2GDRseVApEW6Cy84OuwENP3eelnlUQjyX2th2Bm494qtqjrFxpFL CDtdVDDiMrSDeIaDLE0nMU4PJo6kcGLzoRBo6m8+AG3dSwHV8Y+HqmsPZ4CJyA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1741076873; 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=dMGDQZu5FA95BFqikIlJ7YWTqVrXpl8bK0mGP7UazmU=; b=7VcAwdDz9JhxU83HNUIOdnM5Gcoj0cSeITaCX1Doel5lGuUPxuQePdYfYukriUfa0Zv+DF D/VSKKOVQoufJMCA== From: "tip-bot2 for Brendan Jackman" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cpu] x86/cpu: Warn louder about the {set,clear}cpuid boot parameters Cc: Ingo Molnar , Brendan Jackman , Ingo Molnar , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20250303-setcpuid-taint-louder-v1-2-8d255032cb4c@google.com> References: <20250303-setcpuid-taint-louder-v1-2-8d255032cb4c@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <174107687265.14745.5980705395851261771.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/cpu branch of tip: Commit-ID: cf4d8a642cb8556c3cb786278a6f7fa43bc3f5e9 Gitweb: https://git.kernel.org/tip/cf4d8a642cb8556c3cb786278a6f7fa43= bc3f5e9 Author: Brendan Jackman AuthorDate: Mon, 03 Mar 2025 15:45:38=20 Committer: Ingo Molnar CommitterDate: Mon, 03 Mar 2025 21:23:39 +01:00 x86/cpu: Warn louder about the {set,clear}cpuid boot parameters Commit 814165e9fd1f6 ("x86/cpu: Add the 'setcpuid=3D' boot parameter") recently expanded the user's ability to break their system horribly by overriding effective CPU flags. This was reflected with updates to the documentation to try and make people aware that this is dangerous. To further reduce the risk of users mistaking this for a "real feature", and try to help them figure out why their kernel is tainted if they do use it: - Upgrade the existing printk to pr_warn, to help ensure kernel logs reflect what changes are in effect. - Print an extra warning that tries to be as dramatic as possible, while also highlighting the fact that it tainted the kernel. Suggested-by: Ingo Molnar Signed-off-by: Brendan Jackman Signed-off-by: Ingo Molnar Acked-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20250303-setcpuid-taint-louder-v1-2-8d25503= 2cb4c@google.com --- arch/x86/kernel/cpu/common.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index b5fdaa6..c1ced31 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -1479,12 +1479,12 @@ static void detect_nopl(void) #endif } =20 -static inline void parse_set_clear_cpuid(char *arg, bool set) +static inline bool parse_set_clear_cpuid(char *arg, bool set) { char *opt; int taint =3D 0; =20 - pr_info("%s CPUID bits:", set ? "Force-enabling" : "Clearing"); + pr_warn("%s CPUID bits:", set ? "Force-enabling" : "Clearing"); =20 while (arg) { bool found __maybe_unused =3D false; @@ -1547,10 +1547,9 @@ static inline void parse_set_clear_cpuid(char *arg, = bool set) pr_cont(" (unknown: %s)", opt); } =20 - if (taint) - add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); - pr_cont("\n"); + + return taint; } =20 =20 @@ -1560,6 +1559,7 @@ static inline void parse_set_clear_cpuid(char *arg, b= ool set) */ static void __init cpu_parse_early_param(void) { + bool cpuid_taint =3D false; char arg[128]; int arglen; =20 @@ -1594,11 +1594,16 @@ static void __init cpu_parse_early_param(void) =20 arglen =3D cmdline_find_option(boot_command_line, "clearcpuid", arg, size= of(arg)); if (arglen > 0) - parse_set_clear_cpuid(arg, false); + cpuid_taint |=3D parse_set_clear_cpuid(arg, false); =20 arglen =3D cmdline_find_option(boot_command_line, "setcpuid", arg, sizeof= (arg)); if (arglen > 0) - parse_set_clear_cpuid(arg, true); + cpuid_taint |=3D parse_set_clear_cpuid(arg, true); + + if (cpuid_taint) { + pr_warn("!!! setcpuid=3D/clearcpuid=3D in use, this is for TESTING ONLY,= may break things horribly. Tainting kernel.\n"); + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); + } } =20 /*