Skip to content

kprobes/x86: Preempt related enhancements

Masami Hiramatsu lkml 1 version In review

Get series with b4
b4 am 150581509713.32348.1905525476438163954.stgit@devbox

Versions newest first

  1. v3 Latest7 patches 14 repliesIn review

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7kprobes: Improve smoke test to check preemptiblekernel/test_kprobes.c+20 -00 replies
2/7kprobes/x86: Move get_kprobe_ctlblk in irq-disabled blockarch/x86/kernel/kprobes/opt.c+1 -10 replies
3/7kprobes: Warn if optprobe handler tries to change execution pathkernel/kprobes.c+4 -13 replies
4/7kprobes/x86: Disable preempt in optprobearch/x86/kernel/kprobes/opt.c+2 -00 replies
5/7kprobes/x86: Disable preempt ftrace-based jprobearch/x86/kernel/kprobes/ftrace.c+14 -90 replies
6/7kprobes/x86: Remove disable_irq from ftrace-based/optimized kprobearch/x86/kernel/kprobes/ftrace.c arch/x86/kernel/kprobes/opt.c+2 -112 replies
7/7kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPTarch/Kconfig kernel/kprobes.c+14 -68 replies

Reviews trailers per patch

1 of 7 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchPaul E. McKenneyAlexei Starovoitov
SeriesA-b
1/7
2/7
3/7
4/7
5/7
6/7
7/7R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH -tip v3 0/7] kprobes/x86: Preempt related enhancements

Hi,

Here is the 3rd version of the series to improve preempt related behavior in kprobes/x86. This actually includes many enhancements/fixes from the 2nd version, which is

https://lkml.org/lkml/2017/9/11/482

With the previous patch, lkp-bot reported that an issue ( https://lkml.org/lkml/2017/9/14/3 ) and I couldn't reproduce it. However, I found a suspicious bug and fixed it ([2/7]).

Also, while I was checking the correct condition for *probe handlers in Documentation/kprobes.txt, I also found that current implementations for ftrace-based kprobe and optprobe were mis-reading the document.

Quoted 1 line

From the document, handlers must be run with preempt-

disabled, but interrupt disabling is not guaranteed. So in the middle of this series, patches ([4/7],[5/7], [6/7]) adding preempt-disabling and removing irq-disabling.

And at last, I placed the original patch (Enable optprobe with CONFIG_PREEMPT).

The others are just for making sure this fix works well.
- [1/7] is just adding preemptible checker in kprobe smake tests so that we can easily find mistake.
- [3/7] is adding an assert if user tries to change execution path in optprobe, which is obviously prohibited in the document (there also be how to avoid it.)

Thank you,

---

Masami Hiramatsu (7):
kprobes: Improve smoke test to check preemptible kprobes/x86: Move get_kprobe_ctlblk in irq-disabled block
kprobes: Warn if optprobe handler tries to change execution path kprobes/x86: Disable preempt in optprobe
kprobes/x86: Disable preempt ftrace-based jprobe kprobes/x86: Remove disable_irq from ftrace-based/optimized kprobe
kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT

 arch/Kconfig                     |    2 +-
 arch/x86/kernel/kprobes/ftrace.c |   32 ++++++++++++++++----------------
 arch/x86/kernel/kprobes/opt.c    |    8 +++-----
 kernel/kprobes.c                 |   23 +++++++++++++++++------
 kernel/test_kprobes.c            |   20 ++++++++++++++++++++
 5 files changed, 57 insertions(+), 28 deletions(-)

--
Masami Hiramatsu