uprobes: Introduce arch_uprobe->ixol
authorOleg Nesterov <oleg@redhat.com>
Mon, 4 Nov 2013 19:27:13 +0000 (20:27 +0100)
committerOleg Nesterov <oleg@redhat.com>
Wed, 6 Nov 2013 19:00:05 +0000 (20:00 +0100)
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>
arch/powerpc/include/asm/uprobes.h
arch/x86/include/asm/uprobes.h
kernel/events/uprobes.c

index b6fc3178372aaf77ee2787cb3e2519d392520826..75c6ecdb8f3728a175bd61808cad34a9689fd47e 100644 (file)
@@ -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;
        };
 };
index b20b4d68b934da222a84e2037c6a4e59b32dca88..3087ea9c5f2e86dfcf9c596258a3d1df6f22bc90 100644 (file)
@@ -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
index 0012c8ebb098bccc6175e37c6aa25335c19504c8..fbcff61b5099f841e18680afd132e2f5338e5bd9 100644 (file)
@@ -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.