summaryrefslogtreecommitdiff
path: root/arch/x86/include/asm/uprobes.h
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2014-04-05 22:05:02 +0400
committerOleg Nesterov <oleg@redhat.com>2014-04-17 23:58:22 +0400
commit7ba6db2d688bdf83049a18c8e55b2d1e58e8b0bc (patch)
treec2be845e50bb6057b8ea0716a18bca4120964060 /arch/x86/include/asm/uprobes.h
parent8faaed1b9f500d6cf32702716733a645c9b0727a (diff)
downloadlinux-7ba6db2d688bdf83049a18c8e55b2d1e58e8b0bc.tar.xz
uprobes/x86: Emulate unconditional relative jmp's
Currently we always execute all insns out-of-line, including relative jmp's and call's. This assumes that even if regs->ip points to nowhere after the single-step, default_post_xol_op(UPROBE_FIX_IP) logic will update it correctly. However, this doesn't work if this regs->ip == xol_vaddr + insn_offset is not canonical. In this case CPU generates #GP and general_protection() kills the task which tries to execute this insn out-of-line. Now that we have uprobe_xol_ops we can teach uprobes to emulate these insns and solve the problem. This patch adds branch_xol_ops which has a single branch_emulate_op() hook, so far it can only handle rel8/32 relative jmp's. TODO: move ->fixup into the union along with rip_rela_target_address. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Reported-by: Jonathan Lebon <jlebon@redhat.com> Reviewed-by: Jim Keniston <jkenisto@us.ibm.com>
Diffstat (limited to 'arch/x86/include/asm/uprobes.h')
-rw-r--r--arch/x86/include/asm/uprobes.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/x86/include/asm/uprobes.h b/arch/x86/include/asm/uprobes.h
index 9f8210bcbb49..e9fd4d5537ed 100644
--- a/arch/x86/include/asm/uprobes.h
+++ b/arch/x86/include/asm/uprobes.h
@@ -44,9 +44,15 @@ struct arch_uprobe {
u16 fixups;
const struct uprobe_xol_ops *ops;
+ union {
#ifdef CONFIG_X86_64
- unsigned long rip_rela_target_address;
+ unsigned long rip_rela_target_address;
#endif
+ struct {
+ s32 offs;
+ u8 ilen;
+ } branch;
+ };
};
struct arch_uprobe_task {