[PATCH v2 0/2] x86/retpoline,kprobes: Fix the [__indirect_thunk_start, ..end] range

Petr Pavlu posted 2 patches 2 years, 7 months ago
arch/x86/include/asm/nospec-branch.h |  3 ---
arch/x86/kernel/kprobes/opt.c        | 40 +++++++++++-----------------
arch/x86/kernel/vmlinux.lds.S        |  4 +--
arch/x86/lib/retpoline.S             |  4 +--
tools/perf/util/thread-stack.c       |  4 +--
5 files changed, 20 insertions(+), 35 deletions(-)
[PATCH v2 0/2] x86/retpoline,kprobes: Fix the [__indirect_thunk_start, ..end] range
Posted by Petr Pavlu 2 years, 7 months ago
Fix problems with an output position of thunk sections and the
associated definition of range [__indirect_thunk_start,
__indirect_thunk_end] which affects the kprobes optimization.

Initial v1 of the series kept the mentioned range but it turns out the
logic which uses it is not necessary so it is removed altogether.

Changes since v1 [1]:
- Drop the patch which moved the return thunk out of
  [__indirect_thunk_start, ..end] and instead replace it with a removal
  of the kprobes optimization check which looked for calls to indirect
  thunks.
- Slightly adjust the commit message for the first patch, to better
  match the new second patch.

[1] https://lore.kernel.org/lkml/20230705081547.25130-1-petr.pavlu@suse.com/

Petr Pavlu (2):
  x86/retpoline,kprobes: Fix position of thunk sections with
    CONFIG_LTO_CLANG
  x86/retpoline,kprobes: Skip optprobe check for indirect jumps with
    retpolines and IBT

 arch/x86/include/asm/nospec-branch.h |  3 ---
 arch/x86/kernel/kprobes/opt.c        | 40 +++++++++++-----------------
 arch/x86/kernel/vmlinux.lds.S        |  4 +--
 arch/x86/lib/retpoline.S             |  4 +--
 tools/perf/util/thread-stack.c       |  4 +--
 5 files changed, 20 insertions(+), 35 deletions(-)

-- 
2.35.3
Re: [PATCH v2 0/2] x86/retpoline,kprobes: Fix the [__indirect_thunk_start, ..end] range
Posted by Masami Hiramatsu (Google) 2 years, 6 months ago
Hi Peter,

Can you pick this series to tip tree?
I think, these affect to x86 arch code.

Thank you,

On Tue, 11 Jul 2023 11:19:50 +0200
Petr Pavlu <petr.pavlu@suse.com> wrote:

> Fix problems with an output position of thunk sections and the
> associated definition of range [__indirect_thunk_start,
> __indirect_thunk_end] which affects the kprobes optimization.
> 
> Initial v1 of the series kept the mentioned range but it turns out the
> logic which uses it is not necessary so it is removed altogether.
> 
> Changes since v1 [1]:
> - Drop the patch which moved the return thunk out of
>   [__indirect_thunk_start, ..end] and instead replace it with a removal
>   of the kprobes optimization check which looked for calls to indirect
>   thunks.
> - Slightly adjust the commit message for the first patch, to better
>   match the new second patch.
> 
> [1] https://lore.kernel.org/lkml/20230705081547.25130-1-petr.pavlu@suse.com/
> 
> Petr Pavlu (2):
>   x86/retpoline,kprobes: Fix position of thunk sections with
>     CONFIG_LTO_CLANG
>   x86/retpoline,kprobes: Skip optprobe check for indirect jumps with
>     retpolines and IBT
> 
>  arch/x86/include/asm/nospec-branch.h |  3 ---
>  arch/x86/kernel/kprobes/opt.c        | 40 +++++++++++-----------------
>  arch/x86/kernel/vmlinux.lds.S        |  4 +--
>  arch/x86/lib/retpoline.S             |  4 +--
>  tools/perf/util/thread-stack.c       |  4 +--
>  5 files changed, 20 insertions(+), 35 deletions(-)
> 
> -- 
> 2.35.3
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Re: [PATCH v2 0/2] x86/retpoline,kprobes: Fix the [__indirect_thunk_start, ..end] range
Posted by Peter Zijlstra 2 years, 6 months ago
On Sun, Jul 30, 2023 at 12:14:35AM +0900, Masami Hiramatsu wrote:
> Hi Peter,
> 
> Can you pick this series to tip tree?

Will do!