Re: [PATCH 1/3] Revert "x86/retpoline: Remove .text..__x86.return_thunk section"
From: Peter Zijlstra
Date: Tue Oct 10 2023 - 13:48:44 EST
On Tue, Oct 10, 2023 at 12:10:18PM -0500, David Kaplan wrote:
> arch/x86/kernel/vmlinux.lds.S | 3 +++
> arch/x86/lib/retpoline.S | 2 ++
> 2 files changed, 5 insertions(+)
>
> diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
> index 9cdb1a7332c4..54a5596adaa6 100644
> --- a/arch/x86/kernel/vmlinux.lds.S
> +++ b/arch/x86/kernel/vmlinux.lds.S
> @@ -132,7 +132,10 @@ SECTIONS
> LOCK_TEXT
> KPROBES_TEXT
> SOFTIRQENTRY_TEXT
> +#ifdef CONFIG_RETPOLINE
> *(.text..__x86.indirect_thunk)
> + *(.text..__x86.return_thunk)
> +#endif
> STATIC_CALL_TEXT
>
> ALIGN_ENTRY_TEXT_BEGIN
> diff --git a/arch/x86/lib/retpoline.S b/arch/x86/lib/retpoline.S
> index db813113e637..3da768a71cf9 100644
> --- a/arch/x86/lib/retpoline.S
> +++ b/arch/x86/lib/retpoline.S
> @@ -129,6 +129,8 @@ SYM_CODE_END(__x86_indirect_jump_thunk_array)
>
> #ifdef CONFIG_RETHUNK
Perhaps elucidate the future reader with a comment here? Lest someone
tries removing it again.
>
> + .section .text..__x86.return_thunk
> +
> #ifdef CONFIG_CPU_SRSO