From: Suraj Jitindar Singh <surajjs@amazon.com>
To: <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>,
Josh Poimboeuf <jpoimboe@kernel.org>,
Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"Suraj Jitindar Singh" <surajjs@amazon.com>,
<stable@vger.kernel.org>
Subject: [PATCH 2/2] x86/bugs: Don't WARN() when overwriting retbleed_return_thunk with srso_return_thunk
Date: Thu, 15 May 2025 16:34:33 -0700 [thread overview]
Message-ID: <20250515233433.105054-2-surajjs@amazon.com> (raw)
In-Reply-To: <20250515233433.105054-1-surajjs@amazon.com>
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@vger.kernel.org # 5.15.x-
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.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
next prev parent reply other threads:[~2025-05-15 23:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 22:08 [PATCH] x86/bugs: Don't warn when overwriting retbleed_return_thunk with srso_return_thunk Suraj Jitindar Singh
2025-05-14 22:25 ` Borislav Petkov
2025-05-14 23:30 ` Pawan Gupta
2025-05-15 9:36 ` Borislav Petkov
2025-05-15 17:06 ` Pawan Gupta
2025-05-15 17:23 ` Borislav Petkov
2025-05-15 17:38 ` Pawan Gupta
2025-05-15 22:28 ` Jitindar Singh, Suraj
2025-05-15 23:34 ` [PATCH 1/2] x86/bugs: WARN() when overwriting x86_return_thunk Suraj Jitindar Singh
2025-05-15 23:34 ` Suraj Jitindar Singh [this message]
2025-05-16 7:48 ` [PATCH 2/2] x86/bugs: Don't WARN() when overwriting retbleed_return_thunk with srso_return_thunk Borislav Petkov
2025-05-16 15:18 ` Kaplan, David
2025-05-16 15:40 ` Borislav Petkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250515233433.105054-2-surajjs@amazon.com \
--to=surajjs@amazon.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pawan.kumar.gupta@linux.intel.com \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox