[B][C][SRU][PATCH 0/1] Fix for ftrace test hang issue

Po-Hsu Lin po-hsu.lin at canonical.com
Tue May 7 08:50:05 UTC 2019

BugLink: https://bugs.launchpad.net/bugs/1826385

== Justification ==
Running the ftrace in ubuntu_kernel_selftests repetitively against x86
Cosmic kernel will cause system hang.

When this happens, you won't be able to ssh into this system, and no log
can be found in syslog.

This hang is caused by one of the sub-test: kprobe/multiple_kprobes

Masami's comment from upstream discussion (https://lkml.org/lkml/2018/12/3/1219):
In arch/x86/kernel/kprobes/opt.c, copy_optimized_instructions() does a
copy loop, but only update src and dest cursors, but not update real
address which is used for adjusting RIP relative instruction.

== Fix ==
43a1b0cb4 (kprobes/x86: Fix instruction patching corruption when copying
more than one RIP-relative instruction)

This patch is already in D.
For B/C, they all have this ill-commit 63fef14 and this patch can be
cherry-picked. Note that for Bionic kernel it can only be triggered in
this way with a kernel built with GCC-8.

Although it's a bit difficult to trigger this on Bionic, I think it
worth this fix as it's quite straightforward.

For X, the ill-commit 63fef14 does not exist.

== Test ==
Test kernel for Cosmic and Bionic built with GCC-8:

(To verify this for the Bionic, you will need to build a kernel with GCC-8.)

Patch tested with a bare-metal and a KVM node, both of them can pass the
beating repetitively.

== Regression Potential ==
Low, upstream fix specific for kprobe and limited to x86 architecture.

Masami Hiramatsu (1):
  kprobes/x86: Fix instruction patching corruption when copying more
    than one RIP-relative instruction

 arch/x86/kernel/kprobes/opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


More information about the kernel-team mailing list