Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306637
b: refs/heads/master
c: 900771a
h: refs/heads/master
i:
  306635: c18f532
v: v3
  • Loading branch information
Srikar Dronamraju authored and Ingo Molnar committed Mar 13, 2012
1 parent 7034bdb commit 3111301
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 35aa621b5ab9d08767f7bc8d209b696df281d715
refs/heads/master: 900771a483ef28915a48066d7895d8252315607a
6 changes: 3 additions & 3 deletions trunk/arch/x86/include/asm/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
typedef u8 uprobe_opcode_t;

#define MAX_UINSN_BYTES 16
#define UPROBES_XOL_SLOT_BYTES 128 /* to keep it cache aligned */
#define UPROBE_XOL_SLOT_BYTES 128 /* to keep it cache aligned */

#define UPROBES_BKPT_INSN 0xcc
#define UPROBES_BKPT_INSN_SIZE 1
#define UPROBE_BKPT_INSN 0xcc
#define UPROBE_BKPT_INSN_SIZE 1

struct arch_uprobe {
u16 fixups;
Expand Down
18 changes: 9 additions & 9 deletions trunk/arch/x86/kernel/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
/* Post-execution fixups. */

/* No fixup needed */
#define UPROBES_FIX_NONE 0x0
#define UPROBE_FIX_NONE 0x0
/* Adjust IP back to vicinity of actual insn */
#define UPROBES_FIX_IP 0x1
#define UPROBE_FIX_IP 0x1
/* Adjust the return address of a call insn */
#define UPROBES_FIX_CALL 0x2
#define UPROBE_FIX_CALL 0x2

#define UPROBES_FIX_RIP_AX 0x8000
#define UPROBES_FIX_RIP_CX 0x4000
#define UPROBE_FIX_RIP_AX 0x8000
#define UPROBE_FIX_RIP_CX 0x4000

/* Adaptations for mhiramat x86 decoder v14. */
#define OPCODE1(insn) ((insn)->opcode.bytes[0])
Expand Down Expand Up @@ -269,9 +269,9 @@ static void prepare_fixups(struct arch_uprobe *auprobe, struct insn *insn)
break;
}
if (fix_ip)
auprobe->fixups |= UPROBES_FIX_IP;
auprobe->fixups |= UPROBE_FIX_IP;
if (fix_call)
auprobe->fixups |= UPROBES_FIX_CALL;
auprobe->fixups |= UPROBE_FIX_CALL;
}

#ifdef CONFIG_X86_64
Expand Down Expand Up @@ -341,12 +341,12 @@ static void handle_riprel_insn(struct mm_struct *mm, struct arch_uprobe *auprobe
* is NOT the register operand, so we use %rcx (register
* #1) for the scratch register.
*/
auprobe->fixups = UPROBES_FIX_RIP_CX;
auprobe->fixups = UPROBE_FIX_RIP_CX;
/* Change modrm from 00 000 101 to 00 000 001. */
*cursor = 0x1;
} else {
/* Use %rax (register #0) for the scratch register. */
auprobe->fixups = UPROBES_FIX_RIP_AX;
auprobe->fixups = UPROBE_FIX_RIP_AX;
/* Change modrm from 00 xxx 101 to 00 xxx 000 */
*cursor = (reg << 3);
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/uprobes.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ struct vm_area_struct;
/* flags that denote/change uprobes behaviour */

/* Have a copy of original instruction */
#define UPROBES_COPY_INSN 0x1
#define UPROBE_COPY_INSN 0x1

/* Dont run handlers when first register/ last unregister in progress*/
#define UPROBES_RUN_HANDLER 0x2
#define UPROBE_RUN_HANDLER 0x2

struct uprobe_consumer {
int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs);
Expand Down
18 changes: 9 additions & 9 deletions trunk/kernel/events/uprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ static int __replace_page(struct vm_area_struct *vma, struct page *page, struct
*/
bool __weak is_bkpt_insn(uprobe_opcode_t *insn)
{
return *insn == UPROBES_BKPT_INSN;
return *insn == UPROBE_BKPT_INSN;
}

/*
Expand Down Expand Up @@ -259,8 +259,8 @@ static int write_opcode(struct mm_struct *mm, struct arch_uprobe *auprobe,

/* poke the new insn in, ASSUMES we don't cross page boundary */
vaddr &= ~PAGE_MASK;
BUG_ON(vaddr + UPROBES_BKPT_INSN_SIZE > PAGE_SIZE);
memcpy(vaddr_new + vaddr, &opcode, UPROBES_BKPT_INSN_SIZE);
BUG_ON(vaddr + UPROBE_BKPT_INSN_SIZE > PAGE_SIZE);
memcpy(vaddr_new + vaddr, &opcode, UPROBE_BKPT_INSN_SIZE);

kunmap_atomic(vaddr_new);
kunmap_atomic(vaddr_old);
Expand Down Expand Up @@ -308,7 +308,7 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_
lock_page(page);
vaddr_new = kmap_atomic(page);
vaddr &= ~PAGE_MASK;
memcpy(opcode, vaddr_new + vaddr, UPROBES_BKPT_INSN_SIZE);
memcpy(opcode, vaddr_new + vaddr, UPROBE_BKPT_INSN_SIZE);
kunmap_atomic(vaddr_new);
unlock_page(page);

Expand Down Expand Up @@ -352,7 +352,7 @@ int __weak set_bkpt(struct mm_struct *mm, struct arch_uprobe *auprobe, unsigned
if (result)
return result;

return write_opcode(mm, auprobe, vaddr, UPROBES_BKPT_INSN);
return write_opcode(mm, auprobe, vaddr, UPROBE_BKPT_INSN);
}

/**
Expand Down Expand Up @@ -635,7 +635,7 @@ static int install_breakpoint(struct mm_struct *mm, struct uprobe *uprobe,

addr = (unsigned long)vaddr;

if (!(uprobe->flags & UPROBES_COPY_INSN)) {
if (!(uprobe->flags & UPROBE_COPY_INSN)) {
ret = copy_insn(uprobe, vma, addr);
if (ret)
return ret;
Expand All @@ -647,7 +647,7 @@ static int install_breakpoint(struct mm_struct *mm, struct uprobe *uprobe,
if (ret)
return ret;

uprobe->flags |= UPROBES_COPY_INSN;
uprobe->flags |= UPROBE_COPY_INSN;
}
ret = set_bkpt(mm, &uprobe->arch, addr);

Expand Down Expand Up @@ -857,7 +857,7 @@ int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *
uprobe->consumers = NULL;
__uprobe_unregister(uprobe);
} else {
uprobe->flags |= UPROBES_RUN_HANDLER;
uprobe->flags |= UPROBE_RUN_HANDLER;
}
}

Expand Down Expand Up @@ -889,7 +889,7 @@ void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consume
if (consumer_del(uprobe, consumer)) {
if (!uprobe->consumers) {
__uprobe_unregister(uprobe);
uprobe->flags &= ~UPROBES_RUN_HANDLER;
uprobe->flags &= ~UPROBE_RUN_HANDLER;
}
}

Expand Down

0 comments on commit 3111301

Please sign in to comment.