[PATCH 5.10 RESEND] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk

Jim Mattson posted 1 patch 1 year, 7 months ago
There is a newer version of this series
arch/x86/lib/retpoline.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH 5.10 RESEND] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk
Posted by Jim Mattson 1 year, 7 months ago
The linux-5.10-y backport of commit b377c66ae350 ("x86/retpoline: Add
NOENDBR annotation to the SRSO dummy return thunk") misplaced the new
NOENDBR annotation, repeating the annotation on __x86_return_thunk,
rather than adding the annotation to the !CONFIG_CPU_SRSO version of
srso_alias_untrain_ret, as intended.

Move the annotation to the right place.

Fixes: 0bdc64e9e716 ("x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk")
Reported-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
---
 arch/x86/lib/retpoline.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S
index ab9b047790dd..d1902213a0d6 100644
--- a/arch/x86/lib/retpoline.S
+++ b/arch/x86/lib/retpoline.S
@@ -105,6 +105,7 @@ __EXPORT_THUNK(srso_alias_untrain_ret)
 /* dummy definition for alternatives */
 SYM_START(srso_alias_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
 	ANNOTATE_UNRET_SAFE
+	ANNOTATE_NOENDBR
 	ret
 	int3
 SYM_FUNC_END(srso_alias_untrain_ret)
@@ -258,7 +259,6 @@ SYM_CODE_START(__x86_return_thunk)
 	UNWIND_HINT_FUNC
 	ANNOTATE_NOENDBR
 	ANNOTATE_UNRET_SAFE
-	ANNOTATE_NOENDBR
 	ret
 	int3
 SYM_CODE_END(__x86_return_thunk)
-- 
2.45.2.803.g4e1b14247a-goog
Re: [PATCH 5.10 RESEND] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk
Posted by Greg Kroah-Hartman 1 year, 7 months ago
On Tue, Jul 09, 2024 at 06:20:46AM -0700, Jim Mattson wrote:
> The linux-5.10-y backport of commit b377c66ae350 ("x86/retpoline: Add
> NOENDBR annotation to the SRSO dummy return thunk") misplaced the new
> NOENDBR annotation, repeating the annotation on __x86_return_thunk,
> rather than adding the annotation to the !CONFIG_CPU_SRSO version of
> srso_alias_untrain_ret, as intended.
> 
> Move the annotation to the right place.
> 
> Fixes: 0bdc64e9e716 ("x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk")
> Reported-by: Greg Thelen <gthelen@google.com>
> Signed-off-by: Jim Mattson <jmattson@google.com>
> Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
> Cc: stable@vger.kernel.org
> ---
>  arch/x86/lib/retpoline.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Why is this a RESEND?

And is this only needed in this one stable branch or in any others?

thanks,

greg k-h
Re: [PATCH 5.10 RESEND] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk
Posted by Borislav Petkov 1 year, 7 months ago
On Tue, Jul 09, 2024 at 03:33:54PM +0200, Greg Kroah-Hartman wrote:
> And is this only needed in this one stable branch or in any others?

Lemme take care of them.

Thx.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
[PATCH 6.1] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk
Posted by Borislav Petkov 1 year, 7 months ago
From: Jim Mattson <jmattson@google.com>
Subject: [PATCH] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk

The linux-6.1-y backport of commit b377c66ae350 ("x86/retpoline: Add
NOENDBR annotation to the SRSO dummy return thunk") misplaced the new
NOENDBR annotation, repeating the annotation on __x86_return_thunk,
rather than adding the annotation to the !CONFIG_CPU_SRSO version of
srso_alias_untrain_ret, as intended.

Move the annotation to the right place.

Fixes: 0bdc64e9e716 ("x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk")
Reported-by: Greg Thelen <gthelen@google.com>
Signed-off-by: Jim Mattson <jmattson@google.com>
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
---
 arch/x86/lib/retpoline.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S
index 055955c9bfcb..7880e2a7ec6a 100644
--- a/arch/x86/lib/retpoline.S
+++ b/arch/x86/lib/retpoline.S
@@ -107,6 +107,7 @@ __EXPORT_THUNK(srso_alias_untrain_ret)
 /* dummy definition for alternatives */
 SYM_START(srso_alias_untrain_ret, SYM_L_GLOBAL, SYM_A_NONE)
 	ANNOTATE_UNRET_SAFE
+	ANNOTATE_NOENDBR
 	ret
 	int3
 SYM_FUNC_END(srso_alias_untrain_ret)
@@ -261,7 +262,6 @@ SYM_CODE_START(__x86_return_thunk)
 	UNWIND_HINT_FUNC
 	ANNOTATE_NOENDBR
 	ANNOTATE_UNRET_SAFE
-	ANNOTATE_NOENDBR
 	ret
 	int3
 SYM_CODE_END(__x86_return_thunk)
-- 
2.43.0

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
Re: [PATCH 6.1] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk
Posted by Greg Kroah-Hartman 1 year, 6 months ago
On Tue, Jul 09, 2024 at 04:12:38PM +0200, Borislav Petkov wrote:
> From: Jim Mattson <jmattson@google.com>
> Subject: [PATCH] x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk
> 
> The linux-6.1-y backport of commit b377c66ae350 ("x86/retpoline: Add
> NOENDBR annotation to the SRSO dummy return thunk") misplaced the new
> NOENDBR annotation, repeating the annotation on __x86_return_thunk,
> rather than adding the annotation to the !CONFIG_CPU_SRSO version of
> srso_alias_untrain_ret, as intended.
> 
> Move the annotation to the right place.
> 
> Fixes: 0bdc64e9e716 ("x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk")
> Reported-by: Greg Thelen <gthelen@google.com>
> Signed-off-by: Jim Mattson <jmattson@google.com>
> Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> Cc: stable@vger.kernel.org
> ---
>  arch/x86/lib/retpoline.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Both now queued up, thanks.

greg k-h