lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250515233433.105054-2-surajjs@amazon.com>
Date: Thu, 15 May 2025 16:34:33 -0700
From: Suraj Jitindar Singh <surajjs@...zon.com>
To: <linux-kernel@...r.kernel.org>, <x86@...nel.org>
CC: Thomas Gleixner <tglx@...utronix.de>, Borislav Petkov <bp@...en8.de>,
	Peter Zijlstra <peterz@...radead.org>, Josh Poimboeuf <jpoimboe@...nel.org>,
	Pawan Gupta <pawan.kumar.gupta@...ux.intel.com>, Ingo Molnar
	<mingo@...hat.com>, Dave Hansen <dave.hansen@...ux.intel.com>, "Suraj
 Jitindar Singh" <surajjs@...zon.com>, <stable@...r.kernel.org>
Subject: [PATCH 2/2] x86/bugs: Don't WARN() when overwriting retbleed_return_thunk with srso_return_thunk

There is a special case when the return thunk is overwritten from
retbleed_return_thunk to srso_return_thunk since srso_return_thunk provides
a superset of the functionality of retbleed_return_thunk, and this is
handled correctly in entry_untrain_ret(). Avoid emitting the warning in
this scenario to clarify that this is not an issue.

This situation occurs on certain AMD processors (e.g. Zen2) which are
affected by both retbleed and srso.

Fixes: f4818881c47fd ("x86/its: Enable Indirect Target Selection mitigation")
Cc: stable@...r.kernel.org # 5.15.x-
Signed-off-by: Suraj Jitindar Singh <surajjs@...zon.com>
---
 arch/x86/kernel/cpu/bugs.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 9679fa30563c..840902cee670 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -73,9 +73,14 @@ static void __init set_return_thunk(void *thunk)
 	 * There can only be one return thunk enabled at a time, so issue a
 	 * warning when overwriting it as this is likely a bug which will
 	 * result in a mitigation getting disabled and a vulnerability being
-	 * incorrectly reported in sysfs.
+	 * incorrectly reported in sysfs. retbleed_return_thunk is a special
+	 * case which is safe to be overwritten with srso_return_thunk since it
+	 * provides a superset of the functionality and is handled correctly in
+	 * entry_untrain_ret().
 	 */
-	WARN(x86_return_thunk != __x86_return_thunk,
+	WARN((x86_return_thunk != __x86_return_thunk) &&
+	     (thunk != srso_return_thunk ||
+	      x86_return_thunk != retbleed_return_thunk),
 	     "x86/bugs: return thunk changed from %ps to %ps\n",
 	     x86_return_thunk, thunk);
 
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ