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

From: Masami Hiramatsu
Date: Mon Feb 27 2017 - 11:14:00 EST


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