mbox series

[SRU,jammy,v2,0/5] ftrace graph return address recovery support for s390x Livepatch

Message ID 20230331140041.2112510-1-john.cabaj@canonical.com
Headers show
Series ftrace graph return address recovery support for s390x Livepatch | expand

Message

John Cabaj March 31, 2023, 2 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/2013603 (Kernel livepatch ftrace graph fix)

[Impact]
* Additional patch required to support Livepatch for s390x
* Fixes Livepatch transition issues when using ftrace graph tracing

[Fix]
87cbae6dcc95 ("kprobes: treewide: Remove trampoline_address from kretprobe_trampoline_handler()")
a9623ec2e36c ("kprobes: treewide: Make it harder to refer kretprobe_trampoline directly")
78ef68e5815f ("kprobes: Add kretprobe_find_ret_addr() for searching return address")
d8dd7cae7285 ("390/unwind: recover kretprobe modified return address in stacktrace")
da7a651be4dd ("s390/unwind: fix fgraph return address recovery")

[Test Case]
* Compile tested
* Boot tested
* Tested a Livepatch (patch to /proc/meminfo module)
* Tested Livepatch from ftrace graphed function (via https://github.com/SUSE/qa_test_klp/, klp_tc_10.sh)

[Where things could go wrong]
* Functionality already exists upstream, kernel was boot and Livepatch tested - should have no regressions

-v2:
* Created new BugLink


Masami Hiramatsu (3):
  kprobes: treewide: Remove trampoline_address from
    kretprobe_trampoline_handler()
  kprobes: treewide: Make it harder to refer kretprobe_trampoline
    directly
  kprobes: Add kretprobe_find_ret_addr() for searching return address

Sumanth Korikkar (1):
  s390/unwind: fix fgraph return address recovery

Vasily Gorbik (1):
  s390/unwind: recover kretprobe modified return address in stacktrace

 arch/arc/include/asm/kprobes.h                |   2 +-
 arch/arc/kernel/kprobes.c                     |  13 +-
 arch/arm/probes/kprobes/core.c                |   9 +-
 arch/arm64/include/asm/kprobes.h              |   2 +-
 arch/arm64/kernel/probes/kprobes.c            |   5 +-
 arch/arm64/kernel/probes/kprobes_trampoline.S |   4 +-
 arch/csky/include/asm/kprobes.h               |   2 +-
 arch/csky/kernel/probes/kprobes.c             |   4 +-
 arch/csky/kernel/probes/kprobes_trampoline.S  |   4 +-
 arch/ia64/kernel/kprobes.c                    |  11 +-
 arch/mips/kernel/kprobes.c                    |  15 ++-
 arch/parisc/kernel/kprobes.c                  |   6 +-
 arch/powerpc/include/asm/kprobes.h            |   2 +-
 arch/powerpc/kernel/kprobes.c                 |  18 +--
 arch/powerpc/kernel/optprobes.c               |   2 +-
 arch/powerpc/kernel/stacktrace.c              |   2 +-
 arch/riscv/include/asm/kprobes.h              |   2 +-
 arch/riscv/kernel/probes/kprobes.c            |   4 +-
 arch/riscv/kernel/probes/kprobes_trampoline.S |   4 +-
 arch/s390/include/asm/kprobes.h               |   2 +-
 arch/s390/include/asm/unwind.h                |  13 ++
 arch/s390/kernel/kprobes.c                    |  12 +-
 arch/s390/kernel/stacktrace.c                 |   2 +-
 arch/s390/kernel/unwind_bc.c                  |   8 +-
 arch/sh/include/asm/kprobes.h                 |   2 +-
 arch/sh/kernel/kprobes.c                      |  12 +-
 arch/sparc/include/asm/kprobes.h              |   2 +-
 arch/sparc/kernel/kprobes.c                   |  12 +-
 arch/x86/include/asm/kprobes.h                |   1 -
 arch/x86/kernel/kprobes/core.c                |  22 ++--
 include/linux/kprobes.h                       |  40 ++++++-
 kernel/kprobes.c                              | 112 +++++++++++++-----
 kernel/trace/trace_output.c                   |   2 +-
 33 files changed, 222 insertions(+), 131 deletions(-)

Comments

Tim Gardner March 31, 2023, 2:09 p.m. UTC | #1
On 3/31/23 8:00 AM, John Cabaj wrote:
> BugLink: https://bugs.launchpad.net/bugs/2013603 (Kernel livepatch ftrace graph fix)
> 
> [Impact]
> * Additional patch required to support Livepatch for s390x
> * Fixes Livepatch transition issues when using ftrace graph tracing
> 
> [Fix]
> 87cbae6dcc95 ("kprobes: treewide: Remove trampoline_address from kretprobe_trampoline_handler()")
> a9623ec2e36c ("kprobes: treewide: Make it harder to refer kretprobe_trampoline directly")
> 78ef68e5815f ("kprobes: Add kretprobe_find_ret_addr() for searching return address")
> d8dd7cae7285 ("390/unwind: recover kretprobe modified return address in stacktrace")
> da7a651be4dd ("s390/unwind: fix fgraph return address recovery")
> 
> [Test Case]
> * Compile tested
> * Boot tested
> * Tested a Livepatch (patch to /proc/meminfo module)
> * Tested Livepatch from ftrace graphed function (via https://github.com/SUSE/qa_test_klp/, klp_tc_10.sh)
> 
> [Where things could go wrong]
> * Functionality already exists upstream, kernel was boot and Livepatch tested - should have no regressions
> 
> -v2:
> * Created new BugLink
> 
> 
> Masami Hiramatsu (3):
>    kprobes: treewide: Remove trampoline_address from
>      kretprobe_trampoline_handler()
>    kprobes: treewide: Make it harder to refer kretprobe_trampoline
>      directly
>    kprobes: Add kretprobe_find_ret_addr() for searching return address
> 
> Sumanth Korikkar (1):
>    s390/unwind: fix fgraph return address recovery
> 
> Vasily Gorbik (1):
>    s390/unwind: recover kretprobe modified return address in stacktrace
> 
>   arch/arc/include/asm/kprobes.h                |   2 +-
>   arch/arc/kernel/kprobes.c                     |  13 +-
>   arch/arm/probes/kprobes/core.c                |   9 +-
>   arch/arm64/include/asm/kprobes.h              |   2 +-
>   arch/arm64/kernel/probes/kprobes.c            |   5 +-
>   arch/arm64/kernel/probes/kprobes_trampoline.S |   4 +-
>   arch/csky/include/asm/kprobes.h               |   2 +-
>   arch/csky/kernel/probes/kprobes.c             |   4 +-
>   arch/csky/kernel/probes/kprobes_trampoline.S  |   4 +-
>   arch/ia64/kernel/kprobes.c                    |  11 +-
>   arch/mips/kernel/kprobes.c                    |  15 ++-
>   arch/parisc/kernel/kprobes.c                  |   6 +-
>   arch/powerpc/include/asm/kprobes.h            |   2 +-
>   arch/powerpc/kernel/kprobes.c                 |  18 +--
>   arch/powerpc/kernel/optprobes.c               |   2 +-
>   arch/powerpc/kernel/stacktrace.c              |   2 +-
>   arch/riscv/include/asm/kprobes.h              |   2 +-
>   arch/riscv/kernel/probes/kprobes.c            |   4 +-
>   arch/riscv/kernel/probes/kprobes_trampoline.S |   4 +-
>   arch/s390/include/asm/kprobes.h               |   2 +-
>   arch/s390/include/asm/unwind.h                |  13 ++
>   arch/s390/kernel/kprobes.c                    |  12 +-
>   arch/s390/kernel/stacktrace.c                 |   2 +-
>   arch/s390/kernel/unwind_bc.c                  |   8 +-
>   arch/sh/include/asm/kprobes.h                 |   2 +-
>   arch/sh/kernel/kprobes.c                      |  12 +-
>   arch/sparc/include/asm/kprobes.h              |   2 +-
>   arch/sparc/kernel/kprobes.c                   |  12 +-
>   arch/x86/include/asm/kprobes.h                |   1 -
>   arch/x86/kernel/kprobes/core.c                |  22 ++--
>   include/linux/kprobes.h                       |  40 ++++++-
>   kernel/kprobes.c                              | 112 +++++++++++++-----
>   kernel/trace/trace_output.c                   |   2 +-
>   33 files changed, 222 insertions(+), 131 deletions(-)
> 
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Philip Cox March 31, 2023, 4:50 p.m. UTC | #2
On Fri, 2023-03-31 at 09:00 -0500, John Cabaj wrote:
> BugLink: https://bugs.launchpad.net/bugs/2013603 (Kernel livepatch
> ftrace graph fix)
> 
> [Impact]
> * Additional patch required to support Livepatch for s390x
> * Fixes Livepatch transition issues when using ftrace graph tracing
> 
> [Fix]
> 87cbae6dcc95 ("kprobes: treewide: Remove trampoline_address from
> kretprobe_trampoline_handler()")
> a9623ec2e36c ("kprobes: treewide: Make it harder to refer
> kretprobe_trampoline directly")
> 78ef68e5815f ("kprobes: Add kretprobe_find_ret_addr() for searching
> return address")
> d8dd7cae7285 ("390/unwind: recover kretprobe modified return address
> in stacktrace")
> da7a651be4dd ("s390/unwind: fix fgraph return address recovery")
> 
> [Test Case]
> * Compile tested
> * Boot tested
> * Tested a Livepatch (patch to /proc/meminfo module)
> * Tested Livepatch from ftrace graphed function (via
> https://github.com/SUSE/qa_test_klp/, klp_tc_10.sh)
> 
> [Where things could go wrong]
> * Functionality already exists upstream, kernel was boot and
> Livepatch tested - should have no regressions
> 
> -v2:
> * Created new BugLink
> 
> 
> Masami Hiramatsu (3):
>   kprobes: treewide: Remove trampoline_address from
>     kretprobe_trampoline_handler()
>   kprobes: treewide: Make it harder to refer kretprobe_trampoline
>     directly
>   kprobes: Add kretprobe_find_ret_addr() for searching return address
> 
> Sumanth Korikkar (1):
>   s390/unwind: fix fgraph return address recovery
> 
> Vasily Gorbik (1):
>   s390/unwind: recover kretprobe modified return address in
> stacktrace
> 
>  arch/arc/include/asm/kprobes.h                |   2 +-
>  arch/arc/kernel/kprobes.c                     |  13 +-
>  arch/arm/probes/kprobes/core.c                |   9 +-
>  arch/arm64/include/asm/kprobes.h              |   2 +-
>  arch/arm64/kernel/probes/kprobes.c            |   5 +-
>  arch/arm64/kernel/probes/kprobes_trampoline.S |   4 +-
>  arch/csky/include/asm/kprobes.h               |   2 +-
>  arch/csky/kernel/probes/kprobes.c             |   4 +-
>  arch/csky/kernel/probes/kprobes_trampoline.S  |   4 +-
>  arch/ia64/kernel/kprobes.c                    |  11 +-
>  arch/mips/kernel/kprobes.c                    |  15 ++-
>  arch/parisc/kernel/kprobes.c                  |   6 +-
>  arch/powerpc/include/asm/kprobes.h            |   2 +-
>  arch/powerpc/kernel/kprobes.c                 |  18 +--
>  arch/powerpc/kernel/optprobes.c               |   2 +-
>  arch/powerpc/kernel/stacktrace.c              |   2 +-
>  arch/riscv/include/asm/kprobes.h              |   2 +-
>  arch/riscv/kernel/probes/kprobes.c            |   4 +-
>  arch/riscv/kernel/probes/kprobes_trampoline.S |   4 +-
>  arch/s390/include/asm/kprobes.h               |   2 +-
>  arch/s390/include/asm/unwind.h                |  13 ++
>  arch/s390/kernel/kprobes.c                    |  12 +-
>  arch/s390/kernel/stacktrace.c                 |   2 +-
>  arch/s390/kernel/unwind_bc.c                  |   8 +-
>  arch/sh/include/asm/kprobes.h                 |   2 +-
>  arch/sh/kernel/kprobes.c                      |  12 +-
>  arch/sparc/include/asm/kprobes.h              |   2 +-
>  arch/sparc/kernel/kprobes.c                   |  12 +-
>  arch/x86/include/asm/kprobes.h                |   1 -
>  arch/x86/kernel/kprobes/core.c                |  22 ++--
>  include/linux/kprobes.h                       |  40 ++++++-
>  kernel/kprobes.c                              | 112 +++++++++++++---
> --
>  kernel/trace/trace_output.c                   |   2 +-
>  33 files changed, 222 insertions(+), 131 deletions(-)
> 
> -- 
> 2.34.1
>
Stefan Bader April 3, 2023, 8:59 a.m. UTC | #3
On 31.03.23 16:00, John Cabaj wrote:
> BugLink: https://bugs.launchpad.net/bugs/2013603 (Kernel livepatch ftrace graph fix)
> 

This is through review but some additional notes:

> [Impact]
> * Additional patch required to support Livepatch for s390x

This is not really helping to understand why we end up with 5 patcheS 
instead of a singular patch. Likely pre-reqs but it would be nice to 
explain. One might also mention whether any of those is larger or if all 
are just tiny compared to the real fix.

> * Fixes Livepatch transition issues when using ftrace graph tracing
> 
> [Fix]
> 87cbae6dcc95 ("kprobes: treewide: Remove trampoline_address from kretprobe_trampoline_handler()")
> a9623ec2e36c ("kprobes: treewide: Make it harder to refer kretprobe_trampoline directly")
> 78ef68e5815f ("kprobes: Add kretprobe_find_ret_addr() for searching return address")
> d8dd7cae7285 ("390/unwind: recover kretprobe modified return address in stacktrace")
> da7a651be4dd ("s390/unwind: fix fgraph return address recovery")
> 
> [Test Case]
> * Compile tested
> * Boot tested
> * Tested a Livepatch (patch to /proc/meminfo module)
> * Tested Livepatch from ftrace graphed function (via https://github.com/SUSE/qa_test_klp/, klp_tc_10.sh)
> 
> [Where things could go wrong]
> * Functionality already exists upstream, kernel was boot and Livepatch tested - should have no regressions

Given the diffstat below this seems to be a little vague. Some of the 
arch changes are not relevant as we don't live-patch there. That would 
be good to mention. For the kprobes change, I would prefer some rough 
outline which aspect gets changed. That would help to get a better grasp 
on the done tests to be sufficient. Like which area would likely get 
affected by issues.

-Stefan

> 
> -v2:
> * Created new BugLink
> 
> 
> Masami Hiramatsu (3):
>    kprobes: treewide: Remove trampoline_address from
>      kretprobe_trampoline_handler()
>    kprobes: treewide: Make it harder to refer kretprobe_trampoline
>      directly
>    kprobes: Add kretprobe_find_ret_addr() for searching return address
> 
> Sumanth Korikkar (1):
>    s390/unwind: fix fgraph return address recovery
> 
> Vasily Gorbik (1):
>    s390/unwind: recover kretprobe modified return address in stacktrace
> 
>   arch/arc/include/asm/kprobes.h                |   2 +-
>   arch/arc/kernel/kprobes.c                     |  13 +-
>   arch/arm/probes/kprobes/core.c                |   9 +-
>   arch/arm64/include/asm/kprobes.h              |   2 +-
>   arch/arm64/kernel/probes/kprobes.c            |   5 +-
>   arch/arm64/kernel/probes/kprobes_trampoline.S |   4 +-
>   arch/csky/include/asm/kprobes.h               |   2 +-
>   arch/csky/kernel/probes/kprobes.c             |   4 +-
>   arch/csky/kernel/probes/kprobes_trampoline.S  |   4 +-
>   arch/ia64/kernel/kprobes.c                    |  11 +-
>   arch/mips/kernel/kprobes.c                    |  15 ++-
>   arch/parisc/kernel/kprobes.c                  |   6 +-
>   arch/powerpc/include/asm/kprobes.h            |   2 +-
>   arch/powerpc/kernel/kprobes.c                 |  18 +--
>   arch/powerpc/kernel/optprobes.c               |   2 +-
>   arch/powerpc/kernel/stacktrace.c              |   2 +-
>   arch/riscv/include/asm/kprobes.h              |   2 +-
>   arch/riscv/kernel/probes/kprobes.c            |   4 +-
>   arch/riscv/kernel/probes/kprobes_trampoline.S |   4 +-
>   arch/s390/include/asm/kprobes.h               |   2 +-
>   arch/s390/include/asm/unwind.h                |  13 ++
>   arch/s390/kernel/kprobes.c                    |  12 +-
>   arch/s390/kernel/stacktrace.c                 |   2 +-
>   arch/s390/kernel/unwind_bc.c                  |   8 +-
>   arch/sh/include/asm/kprobes.h                 |   2 +-
>   arch/sh/kernel/kprobes.c                      |  12 +-
>   arch/sparc/include/asm/kprobes.h              |   2 +-
>   arch/sparc/kernel/kprobes.c                   |  12 +-
>   arch/x86/include/asm/kprobes.h                |   1 -
>   arch/x86/kernel/kprobes/core.c                |  22 ++--
>   include/linux/kprobes.h                       |  40 ++++++-
>   kernel/kprobes.c                              | 112 +++++++++++++-----
>   kernel/trace/trace_output.c                   |   2 +-
>   33 files changed, 222 insertions(+), 131 deletions(-)
>