Skip to content

Commit

Permalink
uprobes: Introduce arch_uprobe->ixol
Browse files Browse the repository at this point in the history
Currently xol_get_insn_slot() assumes that we should simply copy
arch_uprobe->insn[] which is (ignoring arch_uprobe_analyze_insn)
just the copy of the original insn.

This is not true for arm which needs to create another insn to
execute it out-of-line.

So this patch simply adds the new member, ->ixol into the union.
This doesn't make any difference for x86 and powerpc, but arm
can divorce insn/ixol and initialize the correct xol insn in
arch_uprobe_analyze_insn().

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
  • Loading branch information
Oleg Nesterov committed Nov 6, 2013
1 parent 736e89d commit 8a8de66
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions arch/powerpc/include/asm/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef ppc_opcode_t uprobe_opcode_t;
struct arch_uprobe {
union {
u8 insn[MAX_UINSN_BYTES];
u8 ixol[MAX_UINSN_BYTES];
u32 ainsn;
};
};
Expand Down
5 changes: 4 additions & 1 deletion arch/x86/include/asm/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ typedef u8 uprobe_opcode_t;

struct arch_uprobe {
u16 fixups;
u8 insn[MAX_UINSN_BYTES];
union {
u8 insn[MAX_UINSN_BYTES];
u8 ixol[MAX_UINSN_BYTES];
};
#ifdef CONFIG_X86_64
unsigned long rip_rela_target_address;
#endif
Expand Down
3 changes: 2 additions & 1 deletion kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,8 @@ static unsigned long xol_get_insn_slot(struct uprobe *uprobe)
return 0;

/* Initialize the slot */
copy_to_page(area->page, xol_vaddr, uprobe->arch.insn, MAX_UINSN_BYTES);
copy_to_page(area->page, xol_vaddr,
uprobe->arch.ixol, sizeof(uprobe->arch.ixol));
/*
* We probably need flush_icache_user_range() but it needs vma.
* This should work on supported architectures too.
Expand Down

0 comments on commit 8a8de66

Please sign in to comment.