Commit 9d9c22cc authored by Borislav Petkov (AMD)'s avatar Borislav Petkov (AMD)

x86/retpoline: Document some thunk handling aspects

After a lot of experimenting (see thread Link points to) document for
now the issues and requirements for future improvements to the thunk
handling and potential issuing of a diagnostic when the default thunk
hasn't been patched out.

This documentation is only temporary and that close before the merge
window it is only a placeholder for those future improvements.
Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20231010171020.462211-1-david.kaplan@amd.com
parent 2d7ce49f
...@@ -129,6 +129,13 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array) ...@@ -129,6 +129,13 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
#ifdef CONFIG_RETHUNK #ifdef CONFIG_RETHUNK
/*
* Be careful here: that label cannot really be removed because in
* some configurations and toolchains, the JMP __x86_return_thunk the
* compiler issues is either a short one or the compiler doesn't use
* relocations for same-section JMPs and that breaks the returns
* detection logic in apply_returns() and in objtool.
*/
.section .text..__x86.return_thunk .section .text..__x86.return_thunk
#ifdef CONFIG_CPU_SRSO #ifdef CONFIG_CPU_SRSO
...@@ -361,6 +368,14 @@ SYM_FUNC_END(call_depth_return_thunk) ...@@ -361,6 +368,14 @@ SYM_FUNC_END(call_depth_return_thunk)
* This code is only used during kernel boot or module init. All * This code is only used during kernel boot or module init. All
* 'JMP __x86_return_thunk' sites are changed to something else by * 'JMP __x86_return_thunk' sites are changed to something else by
* apply_returns(). * apply_returns().
*
* This should be converted eventually to call a warning function which
* should scream loudly when the default return thunk is called after
* alternatives have been applied.
*
* That warning function cannot BUG() because the bug splat cannot be
* displayed in all possible configurations, leading to users not really
* knowing why the machine froze.
*/ */
SYM_CODE_START(__x86_return_thunk) SYM_CODE_START(__x86_return_thunk)
UNWIND_HINT_FUNC UNWIND_HINT_FUNC
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment