]> sourceware.org Git - systemtap.git/commitdiff
* runtime/uprobes/uprobes.[ch], uprobes_i386.[ch],
authorkenistoj <kenistoj>
Tue, 16 Oct 2007 23:40:49 +0000 (23:40 +0000)
committerkenistoj <kenistoj>
Tue, 16 Oct 2007 23:40:49 +0000 (23:40 +0000)
uprobes_ppc64.h, uprobes_s390.h: Adjusted SLOT_IP and
arch_validate_probed_insn to accept task pointer (needed by
x86_64); added uprobe_probept_arch_info and uprobe_task_arch_info
(ditto).
* runtime/uprobes/uprobes_i386.c: Fixed a couple of glitches
discovered when porting to x86_64

ChangeLog
runtime/uprobes/uprobes.c
runtime/uprobes/uprobes.h
runtime/uprobes/uprobes_i386.c
runtime/uprobes/uprobes_i386.h
runtime/uprobes/uprobes_ppc64.h
runtime/uprobes/uprobes_s390.h

index 567b51cab47b57b363e4d04a5788e268f09836c3..e2651a3602c6fe792a2ea7cc0be286f3532b0001 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2007-10-16  Jim Keniston  <jkenisto@us.ibm.com>
+
+       * runtime/uprobes/uprobes.[ch], uprobes_i386.[ch],
+       uprobes_ppc64.h, uprobes_s390.h: Adjusted SLOT_IP and
+       arch_validate_probed_insn to accept task pointer (needed by
+       x86_64); added uprobe_probept_arch_info and uprobe_task_arch_info
+       (ditto).
+       * runtime/uprobes/uprobes_i386.c: Fixed a couple of glitches
+       discovered when porting to x86_64
+
 2007-10-15  Roland McGrath  <roland@redhat.com>
 
        PR 5101
index 01b40670c81d0d176bed3a810fd07299bb5acac7..9f5fddd08137f48a4e460b907111c2f44665ff18 100644 (file)
@@ -251,7 +251,7 @@ static void insert_bkpt(struct uprobe_probept *ppt, struct task_struct *tsk)
                goto out;
        }
 
-       if ((result = arch_validate_probed_insn(ppt)) < 0) {
+       if ((result = arch_validate_probed_insn(ppt, tsk)) < 0) {
                bkpt_insertion_failed(ppt, "instruction type cannot be probed");
                goto out;
        }
@@ -1754,7 +1754,8 @@ static int utask_quiesce_pending_sigtrap(struct uprobe_task *utask)
        if (unlikely(regset == NULL))
                return -EIO;
 
-       if ((*regset->get)(utask->tsk, regset, SLOT_IP * regset->size,
+       if ((*regset->get)(utask->tsk, regset,
+                       SLOT_IP(utask->tsk) * regset->size,
                        regset->size, &insn_ptr, NULL) != 0)
                return -EIO;
 
index 84dd0b2a3f2bc3137bb0ca16a4716057e80b14b1..e8a065992a0a5c5d1027e9136beb06faa7a32c9e 100644 (file)
@@ -278,9 +278,15 @@ struct uprobe_probept {
        /* Saved opcode (which has been replaced with breakpoint) */
        uprobe_opcode_t opcode;
 
-       /* Saved original instruction */
+       /*
+        * Saved original instruction.  This may be modified by
+        * architecture-specific code if the original instruction
+        * can't be single-stepped out of line as-is.
+        */
        uprobe_opcode_t insn[MAX_UINSN_BYTES / sizeof(uprobe_opcode_t)];
 
+       struct uprobe_probept_arch_info arch_info;
+
        /* The parent uprobe_process */
        struct uprobe_process *uproc;
 
@@ -359,6 +365,8 @@ struct uprobe_task {
        /* Saved address of copied original instruction */
        long singlestep_addr;
 
+       struct uprobe_task_arch_info arch_info;
+
        /*
         * Unexpected error in probepoint handling has left task's
         * text or stack corrupted.  Kill task ASAP.
index 214206812530cf4d44aeb81bc81f458aa017b0bd..5fe7d781856121fa765b6711140e6d8d011ac1a1 100644 (file)
@@ -69,8 +69,8 @@
                W(0x80, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)| /* 80 */
                W(0x90, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), /* 90 */
                W(0xa0, 1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,1)| /* a0 */
-               W(0xb0, 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1), /* b0 */
-               W(0xc0, 1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1)| /* c0 */
+               W(0xb0, 1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1), /* b0 */
+               W(0xc0, 1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1)| /* c0 */
                W(0xd0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), /* d0 */
                W(0xe0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)| /* e0 */
                W(0xf0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)  /* f0 */
 
 /*
  * TODO:
- * - Allow valid 2-byte opcodes (first byte = 0x0f).
- * - Where necessary, examine the modrm byte and allow valid instructions
+ * - Where necessary, examine the modrm byte and allow only valid instructions
  * in the different Groups and fpu instructions.
- * - Allow at least some instruction prefixes.
  * - Note: If we go past the first byte, do we need to verify that
  * subsequent bytes were actually there, rather than off the last page?
  * Probably overkill.  We don't verify that they specified the first byte
  * fa, fb - cli, sti
  *
  * opcodes we may need to refine support for:
- * 0f - valid 2-byte opcodes
  * 66 - data16 prefix
  * 8f - Group 1 - only reg = 0 is OK
  * c6-c7 - Group 11 - only reg = 0 is OK
  * d9-df - fpu insns with some illegal encodings
- * fe - Group 4 - only reg = 1 or 2 is OK
+ * fe - Group 4 - only reg = 0 or 1 is OK
  * ff - Group 5 - only reg = 0-6 is OK
  *
  * others -- Do we need to support these?
  */
 
 static
-int arch_validate_probed_insn(struct uprobe_probept *ppt)
+int arch_validate_probed_insn(struct uprobe_probept *ppt,
+                                               struct task_struct *tsk)
 {
        uprobe_opcode_t *insn = ppt->insn;
 
@@ -138,9 +136,9 @@ int arch_validate_probed_insn(struct uprobe_probept *ppt)
                printk(KERN_ERR "uprobes does not currently support probing "
                        "instructions with the 2-byte opcode 0x0f 0x%2.2x\n",
                        insn[1]);
-       }
-       printk(KERN_ERR "uprobes does not currently support probing "
-               "instructions whose first byte is 0x%2.2x\n", insn[0]);
+       } else 
+               printk(KERN_ERR "uprobes does not currently support probing "
+                       "instructions whose first byte is 0x%2.2x\n", insn[0]);
        return -EPERM;
 }
 
index 6e2aae70bf25c0be195a8c84ad0a4fc494fe1d24..e4376b95cb27614eb0ac91de72e6b7c19a3d79d9 100644 (file)
@@ -32,17 +32,22 @@ typedef u8 uprobe_opcode_t;
 #define BREAKPOINT_INSTRUCTION 0xcc
 #define BP_INSN_SIZE 1
 #define MAX_UINSN_BYTES 16
-#define SLOT_IP 12     /* instruction pointer slot from include/asm/elf.h */
+#define SLOT_IP(tsk) 12        /* instruction pointer slot from include/asm/elf.h */
 
 #define BREAKPOINT_SIGNAL SIGTRAP
 #define SSTEP_SIGNAL SIGTRAP
 
+struct uprobe_probept_arch_info {};
+struct uprobe_task_arch_info {};
+
 /* Architecture specific switch for where the IP points after a bp hit */
 #define ARCH_BP_INST_PTR(inst_ptr)     (inst_ptr - BP_INSN_SIZE)
 
 struct uprobe_probept;
 struct uprobe_task;
-static int arch_validate_probed_insn(struct uprobe_probept *ppt);
+struct task_struct;
+static int arch_validate_probed_insn(struct uprobe_probept *ppt,
+                                               struct task_struct *tsk);
 
 /* On i386, the int3 traps leaves eip pointing past the int3 instruction. */
 static inline unsigned long arch_get_probept(struct pt_regs *regs)
index 619ba324f546e07416c7cbdb0727f69ed217b31c..16e119755740db141f566f92bc6cc8e9336c6b92 100644 (file)
@@ -34,15 +34,20 @@ typedef unsigned int uprobe_opcode_t;
 #define BREAKPOINT_INSTRUCTION 0x7fe00008      /* trap */
 #define BP_INSN_SIZE 4
 #define MAX_UINSN_BYTES 4
-#define SLOT_IP 32     /* instruction pointer slot from include/asm/elf.h */
+#define SLOT_IP(tsk) 32        /* instruction pointer slot from include/asm/elf.h */
+
+struct uprobe_probept_arch_info {};
+struct uprobe_task_arch_info {};
 
 /* Architecture specific switch for where the IP points after a bp hit */
 #define ARCH_BP_INST_PTR(inst_ptr)     (inst_ptr)
 
 struct uprobe_probept;
 struct uprobe_task;
+struct task_struct;
 
-static inline int arch_validate_probed_insn(struct uprobe_probept *ppt)
+static inline int arch_validate_probed_insn(struct uprobe_probept *ppt,
+                                               struct task_struct *tsk);
 {
        return 0;
 }
index 4f3a8187f77b531deec0b7d667c38061e3aba469..5c711275963f10de874484c90a189a966cb47826 100644 (file)
@@ -40,9 +40,9 @@ typedef u16 uprobe_opcode_t;
 #define SSTEP_SIGNAL SIGTRAP
 
 #ifdef CONFIG_COMPAT
-#define SLOT_IP (test_tsk_thread_flag(current, TIF_31BIT) ? 0x04 : 0x08)
+#define SLOT_IP(tsk) (test_tsk_thread_flag(tsk, TIF_31BIT) ? 0x04 : 0x08)
 #else
-#define SLOT_IP 0x08
+#define SLOT_IP(tsk) 0x08
 #endif
 
 #define FIXUP_PSW_NORMAL        0x08
@@ -50,12 +50,16 @@ typedef u16 uprobe_opcode_t;
 #define FIXUP_RETURN_REGISTER   0x02
 #define FIXUP_NOT_REQUIRED      0x01
 
+struct uprobe_probept_arch_info {};
+struct uprobe_task_arch_info {};
+
 /* Architecture specific switch for where the IP points after a bp hit */
 #define ARCH_BP_INST_PTR(inst_ptr)     (inst_ptr - BP_INSN_SIZE)
 
 struct uprobe_probept;
 struct uprobe_task;
-static int arch_validate_probed_insn(struct uprobe_probept *ppt);
+static int arch_validate_probed_insn(struct uprobe_probept *ppt,
+                                               struct task_struct *tsk);
 
 /*
  * On s390, a trap leaves the instruction pointer pointing past the
This page took 0.049709 seconds and 5 git commands to generate.