Skip to content

RFC kprobes/x86: Handle probing on ex_table cases

Masami Hiramatsu lkml 1 version In review

Get series with b4
b4 am 148821192807.15765.16863626307263805313.stgit@devbox

Versions newest first

  1. v1 RFC Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kprobes/x86: Use probe_kernel_read instead of memcpyarch/x86/kernel/kprobes/core.c arch/x86/kernel/kprobes/opt.c+9 -30 replies
2/2kprobes/x86: Exit single-stepping before trying fixup_exceptionarch/x86/include/asm/kprobes.h arch/x86/kernel/kprobes/core.c arch/x86/kernel/traps.c+71 -321 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] kprobes/x86: Handle probing on ex_table cases

Hi Peter,

Here, I've tried to handle kprobes on exception expected instructions which are recorded in __ex_table.

1st patch fixes recover_probed_instruction() to use probe_kernel_read() instead of memcpy kernel text. So, if you need to get the original instruction for checking the cause of #UD, you can use it instead of probe_kernel_read().

2nd patch adds kprobe_exit_singlestep() right before fixup_exception(), which fixes regs->ip to point original address and reset current singlestepping process so that fixup_exeption() can handle the exception correctly.

There seems some die() still not be fixed up. I'm not sure we should fix that die() messages too. Would we better fixup regs->ip in those cases?

Thank you,

---

Masami Hiramatsu (2):
kprobes/x86: Use probe_kernel_read instead of memcpy kprobes/x86: Exit single-stepping before trying fixup_exception

 arch/x86/include/asm/kprobes.h |    1 
 arch/x86/kernel/kprobes/core.c |   90 +++++++++++++++++++++++++---------------
 arch/x86/kernel/kprobes/opt.c  |    5 ++
 arch/x86/kernel/traps.c        |   19 ++++++++
 4 files changed, 80 insertions(+), 35 deletions(-)

--
Masami Hiramatsu