Commit 7131c2e9 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'probes-fixes-v6.7-rc8' of...

Merge tag 'probes-fixes-v6.7-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace

Pull kprobes/x86 fix from Masami Hiramatsu:

 - Fix to emulate indirect call which size is not 5 byte.

   Current code expects the indirect call instructions are 5 bytes, but
   that is incorrect. Usually indirect call based on register is shorter
   than that, thus the emulation causes a kernel crash by accessing
   wrong instruction boundary. This uses the instruction size to
   calculate the return address correctly.

* tag 'probes-fixes-v6.7-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
  x86/kprobes: fix incorrect return address calculation in kprobe_emulate_call_indirect
parents 3eca8945 f5d03da4
...@@ -576,7 +576,8 @@ static void kprobe_emulate_call_indirect(struct kprobe *p, struct pt_regs *regs) ...@@ -576,7 +576,8 @@ static void kprobe_emulate_call_indirect(struct kprobe *p, struct pt_regs *regs)
{ {
unsigned long offs = addrmode_regoffs[p->ainsn.indirect.reg]; unsigned long offs = addrmode_regoffs[p->ainsn.indirect.reg];
int3_emulate_call(regs, regs_get_register(regs, offs)); int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + p->ainsn.size);
int3_emulate_jmp(regs, regs_get_register(regs, offs));
} }
NOKPROBE_SYMBOL(kprobe_emulate_call_indirect); NOKPROBE_SYMBOL(kprobe_emulate_call_indirect);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment