diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-04-07 10:22:58 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2014-04-17 15:58:25 -0400 |
commit | 6cc5e7ff2c38641060f20786a5caf2815edbca5f (patch) | |
tree | 393f386a447bf0c124a685c9eaa5d8e87b5d167d | |
parent | 8f95505bc18a026ef7d3dfdbce4e5b31b3e4fc1b (diff) |
uprobes/x86: Emulate relative conditional "near" jmp's
Change branch_setup_xol_ops() to simply use opc1 = OPCODE2(insn) - 0x10
if OPCODE1() == 0x0f; this matches the "short" jmp which checks the same
condition.
Thanks to lib/insn.c, it does the rest correctly. branch->ilen/offs are
correct no matter if this jmp is "near" or "short".
Reported-by: Jonathan Lebon <jlebon@redhat.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Jim Keniston <jkenisto@us.ibm.com>
-rw-r--r-- | arch/x86/kernel/uprobes.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/uprobes.c b/arch/x86/kernel/uprobes.c index 0460d04f0acc..ace22916ade3 100644 --- a/arch/x86/kernel/uprobes.c +++ b/arch/x86/kernel/uprobes.c | |||
@@ -599,6 +599,14 @@ static int branch_setup_xol_ops(struct arch_uprobe *auprobe, struct insn *insn) | |||
599 | branch_clear_offset(auprobe, insn); | 599 | branch_clear_offset(auprobe, insn); |
600 | break; | 600 | break; |
601 | 601 | ||
602 | case 0x0f: | ||
603 | if (insn->opcode.nbytes != 2) | ||
604 | return -ENOSYS; | ||
605 | /* | ||
606 | * If it is a "near" conditional jmp, OPCODE2() - 0x10 matches | ||
607 | * OPCODE1() of the "short" jmp which checks the same condition. | ||
608 | */ | ||
609 | opc1 = OPCODE2(insn) - 0x10; | ||
602 | default: | 610 | default: |
603 | if (!is_cond_jmp_opcode(opc1)) | 611 | if (!is_cond_jmp_opcode(opc1)) |
604 | return -ENOSYS; | 612 | return -ENOSYS; |