Skip to contentSkip to conversation

x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk

PATCH Superseded Jim Mattson 3 participants 5 messages Jul 8, 2024 – Jul 9, 2024 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/retpoline: Move a NOENDBR annotation to the SRSO dummy return thunk

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")
---
 arch/x86/lib/retpoline.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/retpoline.S +1 -1
index ab9b047790dd..d1902213a0d6 100644
@@ -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)
Signature · 1 line
2.45.2.803.g4e1b14247a-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 28 lines · Jim Mattson

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")
---
 arch/x86/lib/retpoline.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/retpoline.S +1 -0
index ab9b047790dd..d1902213a0d6 100644
@@ -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)

arch/x86/lib/retpoline.S SYM_CODE_START(__x86_return_thunk) · line 261

Quoted 4 lines
arch/x86/lib/retpoline.S +0 -1
@@ -258,7 +259,6 @@ SYM_CODE_START(__x86_return_thunk)
 	UNWIND_HINT_FUNC
 	ANNOTATE_NOENDBR
 	ANNOTATE_UNRET_SAFE
-	ANNOTATE_NOENDBR

Whoops, those two here didn't look right, thanks for catching this.

And looking at 6.1, it is wrong there too. :-\

commit 7ef6a7f9b32fdfc8bec0a10e6d5ac5374d4f02e7

Author: Borislav Petkov (AMD) <[email protected]>
Date:   Fri Apr 5 16:46:37 2024 +0200

x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk

commit b377c66ae3509ccea596512d6afb4777711c4870 upstream.

Greg (KH - there's another Greg on CC too :-)), do you prefer such stable-only fixes like that or should we revert the wrong backports and redo them?

Thx!

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#2 lore raw
Quoted 44 lines · Borislav Petkov
Quoted 28 lines · Jim Mattson

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")
---
 arch/x86/lib/retpoline.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/lib/retpoline.S +1 -0
index ab9b047790dd..d1902213a0d6 100644
@@ -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)

arch/x86/lib/retpoline.S SYM_CODE_START(__x86_return_thunk) · line 261

Quoted 4 lines
arch/x86/lib/retpoline.S +0 -1
@@ -258,7 +259,6 @@ SYM_CODE_START(__x86_return_thunk)
 	UNWIND_HINT_FUNC
 	ANNOTATE_NOENDBR
 	ANNOTATE_UNRET_SAFE
-	ANNOTATE_NOENDBR

Whoops, those two here didn't look right, thanks for catching this.

And looking at 6.1, it is wrong there too. :-\

commit 7ef6a7f9b32fdfc8bec0a10e6d5ac5374d4f02e7

Author: Borislav Petkov (AMD) <[email protected]>
Date:   Fri Apr 5 16:46:37 2024 +0200
Quoted 6 lines

x86/retpoline: Add NOENDBR annotation to the SRSO dummy return thunk

commit b377c66ae3509ccea596512d6afb4777711c4870 upstream.

Greg (KH - there's another Greg on CC too :-)), do you prefer such stable-only fixes like that or should we revert the wrong backports and redo them?

Sending fixups like this, for things that are already committed are fine. But note, someone needs to at least send them to the right place (i.e. no one cc:ed [email protected]...) if they wish to see them applied to a stable kernel...

thanks,

greg k-h

maintainer
#3 lore raw
Quoted 4 lines · Greg Kroah-Hartman

Sending fixups like this, for things that are already committed are fine. But note, someone needs to at least send them to the right place (i.e. no one cc:ed [email protected]...) if they wish to see them applied to a stable kernel...

Jim, should I or you want?

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette
#4 lore raw
Quoted 8 lines · Borislav Petkov
Quoted 4 lines · Greg Kroah-Hartman

Sending fixups like this, for things that are already committed are fine. But note, someone needs to at least send them to the right place (i.e. no one cc:ed [email protected]...) if they wish to see them applied to a stable kernel...

Jim, should I or you want?

Done.

Quoted 7 lines

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette