[PATCH 0/1] x86/kprobes: Classify opcode while preparing kprobe

From: Masami Hiramatsu
Date: Sun Dec 06 2020 - 09:12:36 EST


Hi,

I noticed that the kprobe x86 still has an inefficient code.

Currently kprobes x86 decodes opcode right after single
stepping in resume_execution(), which is kprobe's hot path.
But it already decoded the opcode while preparing
arch_specific_insn in arch_copy_kprobe(), so this is
inefficient.

So decode the opcode while preparing kprobes (arch_copy_kprobe())
instead of resume_execution() and set some flags for resuming from
single stepping. This also removes the custom instruction prefix
decoding, which should be done in x86 instruction decoder.

Thank you,

---

Masami Hiramatsu (1):
x86/kprobes: Do not decode opcode in resume_execution()


arch/x86/include/asm/kprobes.h | 11 ++-
arch/x86/kernel/kprobes/core.c | 166 ++++++++++++++++++----------------------
2 files changed, 80 insertions(+), 97 deletions(-)

--
Masami Hiramatsu (Linaro) <mhiramat@xxxxxxxxxx>