When the exact same return thunk is already set, avoid the warning and exit
early. This is to prepare for ITS to also set CDT return thunk independent
of retbleed.
Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
---
arch/x86/kernel/cpu/bugs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 94d0de3e61aec32b3b67c8d21f89a8c67b93dff3..354593065025fd7c5727e955d76523777b3da9ee 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -113,6 +113,9 @@ void (*x86_return_thunk)(void) __ro_after_init = __x86_return_thunk;
static void __init set_return_thunk(void *thunk)
{
+ if (thunk == x86_return_thunk)
+ return;
+
if (x86_return_thunk != __x86_return_thunk)
pr_warn("x86/bugs: return thunk changed\n");
--
2.34.1
On Thu, May 22, 2025 at 06:21:02PM -0700, Pawan Gupta wrote:
> When the exact same return thunk is already set, avoid the warning and exit
> early. This is to prepare for ITS to also set CDT return thunk independent
> of retbleed.
>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> ---
> arch/x86/kernel/cpu/bugs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 94d0de3e61aec32b3b67c8d21f89a8c67b93dff3..354593065025fd7c5727e955d76523777b3da9ee 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -113,6 +113,9 @@ void (*x86_return_thunk)(void) __ro_after_init = __x86_return_thunk;
>
> static void __init set_return_thunk(void *thunk)
> {
> + if (thunk == x86_return_thunk)
> + return;
> +
> if (x86_return_thunk != __x86_return_thunk)
> pr_warn("x86/bugs: return thunk changed\n");
Ok, let's drop those silly conditionals here and simply issue the name. We'll
see later whether this needs to be louder...
---
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 94d0de3e61ae..20696abd1bef 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -113,10 +113,9 @@ void (*x86_return_thunk)(void) __ro_after_init = __x86_return_thunk;
static void __init set_return_thunk(void *thunk)
{
- if (x86_return_thunk != __x86_return_thunk)
- pr_warn("x86/bugs: return thunk changed\n");
-
x86_return_thunk = thunk;
+
+ pr_info("active return thunk: %ps\n", thunk);
}
/* Update SPEC_CTRL MSR and its cached copy unconditionally */
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
On Sat, May 24, 2025 at 01:27:29PM +0200, Borislav Petkov wrote:
> On Thu, May 22, 2025 at 06:21:02PM -0700, Pawan Gupta wrote:
> > When the exact same return thunk is already set, avoid the warning and exit
> > early. This is to prepare for ITS to also set CDT return thunk independent
> > of retbleed.
> >
> > Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> > ---
> > arch/x86/kernel/cpu/bugs.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> > index 94d0de3e61aec32b3b67c8d21f89a8c67b93dff3..354593065025fd7c5727e955d76523777b3da9ee 100644
> > --- a/arch/x86/kernel/cpu/bugs.c
> > +++ b/arch/x86/kernel/cpu/bugs.c
> > @@ -113,6 +113,9 @@ void (*x86_return_thunk)(void) __ro_after_init = __x86_return_thunk;
> >
> > static void __init set_return_thunk(void *thunk)
> > {
> > + if (thunk == x86_return_thunk)
> > + return;
> > +
> > if (x86_return_thunk != __x86_return_thunk)
> > pr_warn("x86/bugs: return thunk changed\n");
>
> Ok, let's drop those silly conditionals here and simply issue the name. We'll
> see later whether this needs to be louder...
Ok, will do.
On 5/23/25 04:21, Pawan Gupta wrote:
> When the exact same return thunk is already set, avoid the warning and exit
> early. This is to prepare for ITS to also set CDT return thunk independent
> of retbleed.
Reviewed-by: Nikolay Borisov <nik.borisov@suse.com>
>
> Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
> ---
> arch/x86/kernel/cpu/bugs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
> index 94d0de3e61aec32b3b67c8d21f89a8c67b93dff3..354593065025fd7c5727e955d76523777b3da9ee 100644
> --- a/arch/x86/kernel/cpu/bugs.c
> +++ b/arch/x86/kernel/cpu/bugs.c
> @@ -113,6 +113,9 @@ void (*x86_return_thunk)(void) __ro_after_init = __x86_return_thunk;
>
> static void __init set_return_thunk(void *thunk)
> {
> + if (thunk == x86_return_thunk)
> + return;
> +
> if (x86_return_thunk != __x86_return_thunk)
> pr_warn("x86/bugs: return thunk changed\n");
>
>
© 2016 - 2025 Red Hat, Inc.